[Haskell-cafe] ok, someone check me on this (type unification
from the (>>=)/fmap thread)
rendel at cs.au.dk
Sun May 10 13:01:25 EDT 2009
Brandon S. Allbery KF8NH wrote:
> I can't tell where I'm making the mistake here.
I'm not sure, but I guess you are mixing up some names. Did you make
sure that all type variables are distinct before starting to unify?
> ... must have already unified (a) and (b) ...
Why should it unify a and b?
> Can the typechecker really get the Num to the other end of (a -> m b)
> without also getting the (a) there? Or is it checking for the Num
> constraint before it has fully evaluated the type of (m b)? I
> thought typeclass constraints happened later than basic type
I think you can unify without looking at typeclass constraints at all,
then apply the resulting substitutions to the original constraints. (As
long as there are not functional dependencies involved, at least).
More information about the Haskell-Cafe