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

Possible improvement for misuse of (::) operator #245

Open gamebox opened 6 years ago

gamebox commented 6 years ago

When getting started, a user may incorrectly use the (::) operator like List.append, trying to join two lists. The error messaging is very vague, and may cause as much confusion as it diffuses. See the following SSCCE:

See on ellie

Maybe when we see a situation where a function or operator is of the shape:

a -> Collection a -> Collection a

And the left side is Collection a, we can emit an error like

This operator looks to be looking for a single element of type a for the left side, but you are passing a Collection of type a.

Either the left side should be:

a

Or the right side should be:

Collection (Collection a)

Is this possible, or does it make sense?