Excessive restriction in ghc ?

Sebastien Carlier [email protected]
Tue, 19 Dec 2000 15:15:16 +0100


Hello.

I am getting an error message from ghc 4.08.1 with
the following code:

> class Collection e ce | ce -> e where
>     empty :: ce
>     insert :: e -> ce -> ce
>
> class (Eq e, Collection e ce) => Set e ce where
>     member :: e -> ce -> Bool
>     union :: ce -> ce -> ce

Main.lhs:7:
    Class type variable `e' does not appear in method signature
        union :: {- implicit forall -} ce -> ce -> ce

Since `ce' uniquely determines `e', I would expect the
compiler to assume that `e' appears in the method signature.
Either I am misunderstanding something, or something may be
missing in the compiler around rename/RnSource.lhs:249.

Regards,
Sebastien Carlier