
9 Jul
2002
9 Jul
'02
11:37 a.m.
Simon Peyton-Jones wrote:
| info :: (Collects e ce, Show e) => ce -> String | info v = show ((one v) ::e)
As the error message says, and as the Haskell report says, this means
info v = show ((one v) :: (forall e.e))
which is not what you meant.
Ok, I did not know that I have to mention a type variable in the pattern on the lhs in order to use it monomorphically on the rhs, like in: info (v :: ce) = show (one (v :: ce)) Still, I would like to get "e" as a monomorphic type from the functional dependency "ce -> e" in class Collects, maybe as a language extension in the form of: info (v :: ce | ce -> e) = show ((one v) :: e) Cheers Christian