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 regarding function type missing "to" #265

Closed tilmans closed 5 years ago

tilmans commented 6 years ago

I would expect: "... But (|>) is piping it to a function that expects..."

-- TYPE MISMATCH ----------------------------------------------- src/GeoJson.elm

This function cannot handle the argument sent through the (|>) pipe:

314|         coordinates
315|             |> List.map Json.float
316|             |> Json.list
                    ^^^^^^^^^
The argument is:

    List Json.Value

But (|>) is piping it a function that expects:

    a -> Json.Value
evancz commented 5 years ago

Thank you for reporting this! I remember fixing this recently, and my development build looks like it has the word added:

import Json.Encode as Json

func coordinates =
  coordinates
    |> List.map Json.float
    |> Json.list
-- TYPE MISMATCH ------------------------------------------------------ temp.elm

This function cannot handle the argument sent through the (|>) pipe:

4|   coordinates
5|     |> List.map Json.float
6|     |> Json.list
          ^^^^^^^^^
The argument is:

    List Json.Value

But (|>) is piping it to a function that expects:

    a -> Json.Value

The fix should come out with Elm 0.19.1 which has a bunch of other improvements.