elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Record mismatch could give more specification error #214

Open nbardy opened 7 years ago

nbardy commented 7 years ago
==================================== ERRORS ====================================

-- TYPE MISMATCH -------------- /home/nicholas/Dropbox/act/namesake/src/Main.elm

The argument to function `style` is causing a mismatch.

176|                Text.style
177|>                { default
178|>                    | height = Just 72
179|>                    , bold = 12
180|>                    , color = (Color.rgb 255 255 255)
181|>                }

Function `style` is expecting the argument to be:

    Text.Style

But it is:

    { italic : Bool
    , line : Maybe Text.Line
    , typeface : List String
    , bold : number
    , color : Color
    , height : Maybe Float
    }

Hint: Problem in the `bold` field. I always figure out field types in
alphabetical order. If a field seems fine, I assume it is "correct" in
subsequent checks. So the problem may actually be a weird interaction with
previous fields.

This could say the Type of the field expected. This would save the extra time spent looking up what the Text.Style .bool type is. For example:


Hint: Problem in the `bool` field. bool expected Type `Bool` but it is `number`.