Hello!
The following datatype declaration would, if possible,
actually be very useful for an application I have in mind:
> module Test(V(..)) where
>
> import ST
>
> data V s = forall a . MkV (STRef s a) deriving Eq
But when compiling it with Ghc-4.00 I get:
==============
ecserver ~~ ghc -fglasgow-exts -c test.hs
test.hs:5:
Inferred type is less polymorphic than expected
Quantified type variable `a' is unified with `a1'
When checking an existential pattern that binds
a1 :: STRef s a1
b1 :: STRef s1 a
In an equation for function `==':
== (MkV a1) (MkV b1) = (a1 PrelBase.== b1)
In the definition for method `=='
Compilation had errors
==============
(Essentially the same happens in Hbc.)
Do I have to understand this error message as signalling that
the ``deriving'' mechanism may not yet be fully aware
of existentially quantified constructors?
(It should be prepared that the rule
== (MkV a1) (MkV b1) = (a1 PrelBase.== b1)
may not be applicable for typing reasons,
i.e., before the program-side pattern ``== (MkV a1) (MkV b1)''
is matched, the typing pattern induced by it should be allowed to fail.)
Or is this a design design that I just could not find
any documentation for?
Would other people also like to derive classes in such a way for
existentially quantified datatypes?
BTW, the sparc-sun-solaris binary is not at the end of its link
in the Ghc download page.
Best regards,
Wolfram