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

Error message doesn't say that issue is due to conflict between same-named functions from different modules #301

Open ghost opened 5 years ago

ghost commented 5 years ago
import Element.Input exposing (button)
import Html exposing (button)

...

view model =
    button []
            { onPress = ...
            , label = ...
            }
-- TYPE MISMATCH -------------------------------------------------- src/Main.elm

The 2nd argument to `button` is not what I expect:

217|         , button []
218|>            { onPress = ...
219|>            , label = ...
220|>            }

This argument is a record of type:

    { label : Element.Element msg, onPress : Maybe Msg }

But `button` needs the 2nd argument to be:

    List (Html msg)

Hint: I always figure out the argument types from left to right. If an argument
is acceptable, I assume it is “correct” and move on. So the problem may actually
be in one of the previous arguments!

I think the error message should point out that button could be Html.button or Element.Input.button.