-
Notifications
You must be signed in to change notification settings - Fork 570
Closed
Milestone
Description
Given this code:
> let f x y = x + x * y
Error found:
in module $PSCI
at line 1, column 5 - line 1, column 21
No type class instance was found for
Prelude.Semiring _0
The instance head contains unknown type variables. Consider adding a type annotation.
in value declaration f
where _0 is an unknown type
the error message does the job well enough, I think.
However, for functions with large bodies, it can be difficult to track down why the constraint is required - which is a problem if you weren't intending your function to have that constraint at all. GHC includes a little extra information for missing instance errors, something like this:
No instance for (Num a1) arising from a use of ‘+’
In the expression: x + x * y
Could psc do this too?
Reactions are currently unavailable