Hal

I don't quite understand the intuitions behind your program, but the
bug is easy enough:

| instance (Eq e, Foo p) => Foo (Wrap p) where
|   foo (Bar p) e q = foo p e q

This instance declaration is guaranteed to give problems if it is
ever used, and GHC should probably bleat about it.  Suppose 
you have the constraint 

        Foo (Wrap T)

where T is some type.  Using the instance declaration we can simplify
this to the constraints

        Eq e
        Foo T

where e is a fresh type variable.  But we are never going to learn any
thing more about 'e', and so it is correctly reported as ambiguous.
It's
like writing

        reverse :: Eq x => [a] -> [a]

Any call to this 'reverse' will give a constraint (Eq x) that is
ambiguous.


Really, GHC should reject the instance declaration.

Simon
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to