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

Detect wrong function call syntax #213

Open norpan opened 7 years ago

norpan commented 7 years ago

Somebody asked about this error. Perhaps it could be improved by detecting the following: Type mismatch. Mismatching type is a tuple where the first argument would match. Suggest user may have used function(arg1,arg2) syntax instead of function arg1 arg2

334|                     Dict.insert(id, updatedCharacter, state.characters)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Function `insert` is expecting the argument to be:

    ( String
    , { char : Instance.Char
    , currentLocation : Hash
    , usedDicePool : Character.UsedDicePool
    }
    , Dict String Character.State
    )

But it is:

    ( String
    , { char : Instance.Char
    , currentLocation : Hash
    , usedDicePool : Character.UsedDicePool
    }
    , Dict String Character.State
    )

Hint: Only ints, floats, chars, strings, lists, and tuples are comparable.
norpan commented 7 years ago

Also, it's not really expecting the argument to be that, it's expecting it to be comparable. The hint is helpful but the actual message is confusing.