ghci 5.00 instance declaration error
Martin Sulzmann
sulzmann at cs.mu.OZ.AU
Sun Oct 28 23:52:57 EST 2001
Consider the following program:
--------------------
module MZip where
class MZip a where mzip :: a
instance (MZip (as->bs->ds), MZip(ds->cs->r)) => MZip (as->bs->cs->r) where
mzip as bs cs = mzip (mzip as bs) cs
----------------------------
I get the following error message:
Compiling MZip ( MZip2.hs, interpreted )
MZip2.hs:9:
Could not deduce `MZip (t -> cs -> r)'
from the context (MZip (as -> bs -> cs -> r),
MZip (as -> bs -> ds),
MZip (ds -> cs -> r))
Probable fix:
Add `MZip (t -> cs -> r)' to the instance declaration context
Or add an instance declaration for `MZip (t -> cs -> r)'
arising from use of `mzip' at MZip2.hs:9
in the definition of function `mzip': mzip (mzip as bs) cs
MZip2.hs:9:
Could not deduce `MZip (as -> bs -> t)'
from the context (MZip (as -> bs -> cs -> r),
MZip (as -> bs -> ds),
MZip (ds -> cs -> r))
Probable fix:
Add `MZip (as -> bs -> t)' to the instance declaration context
Or add an instance declaration for `MZip (as -> bs -> t)'
arising from use of `mzip' at MZip2.hs:9
In the first argument of `mzip', namely `(mzip as bs)'
in the definition of function `mzip': mzip (mzip as bs) cs
I used ghci -fglasgow-exts -fallow-undecidable-instances
Note that If I use only (empty instance declaration)
instance (MZip (as->bs->ds), MZip(ds->cs->r)) => MZip (as->bs->cs->r)
everything works fine.
Why do I get an error message of I include the body of the where
statement? Is there a form of skolemization happening?
It seems to me a limitation of the implementation.
Martin
More information about the Glasgow-haskell-bugs
mailing list