Hey reasonml,
Since the release of https://reasonml.github.io/blog/2017/08/25/way-nicer-error-messages.html, I haven’t seen an improvement into error messages and I got a question about them.
While working with Reason you might encounter errors that look like that:
This value might need to be wrapped in a function that takes an extra
parameter of type string
Here's the original error message
This has type:
unit
But somewhere wanted:
string => unit
and the only complaint that I have that might save a lot of time for not only new comers it’s to try give as maximum information about the “somewhere”. Giving the filename at least or even the apply where is being used would be a life saver.
This is the error that appears in Elm’s compiler for similar cases:
-- TYPE MISMATCH ---------------------------- Main.elm
The 1st argument to `drop` is not what I expect:
8| List.drop (String.toInt userInput) [1,2,3,4,5,6]
^^^^^^^^^^^^^^^^^^^^^^
This `toInt` call produces:
Maybe Int
But `drop` needs the 1st argument to be:
Int
Hint: Use Maybe.withDefault to handle possible errors.
Let me know if that make sense or if it’s an unchangeable particularity of ocaml’s compiler.
Thanks!