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

Confusing message, inference beats annotation? #115

Closed glenjamin closed 8 years ago

glenjamin commented 8 years ago

Hello, sorry if this is a dupe - I'm brand new to elm so I'm not quite sure what terms to use when searching.

I was changing the elm architecture part 3 to include the ID of each counter on the page, when I made a mistake:

viewCounter : Signal.Address Action -> ( ID, Counter.Model ) -> Html
viewCounter address ( id, model ) =
  div
    []
    [ (text id)
    , Counter.view (Signal.forwardTo address (Modify id)) model
    ]

The mistake is that I've failed to convert the id param into the string needed by text.

However, the build error is:

-- TYPE MISMATCH ------------------------------------------- ././CounterList.elm

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

96│                                               Modify id)
                                                         ^^
Function `Modify` is expecting the argument to be:

    Int

But it is:

    String

Detected errors in 1 module.

Whereas I'd expect to get the error against the text call.

jvoigtlaender commented 8 years ago

It is indeed a duplicate. For example of https://github.com/elm-lang/error-message-catalog/issues/110, but there's also others already.

rtfeldman commented 8 years ago

Closing as duplicate of #110. Thanks!