William Lee Irwin III wrote:

Example> let x = cmethod . fromNat $ 1 in 0
ERROR: Unresolved overloading
*** Type       : (Q a, P a) => Integer
*** Expression : let {...} in 0


The type of x is t ( for some t in Num)

OK. What is t? It's unspecified. You don't actually need it. Too bad.

Type inference depends both on the arguments of a function and on the
use of the result. While functions with types like t->t can determine t
from either, functions with types like Integer -> t need the surrounding
context. If you discard the result (your x is never used) t remains
ambiguous. Haskell regards this as an error.

Does this matter? Well, sometimes it does, and sometimes it is just a
nuisance, but in your case, the definition of x is dead code, and you
are free to delete it. If you were to use x somewhere, your problem
would probably go away.

--brian

Reply via email to