[Haskell-cafe] Existentially-quantified constructors, Eq and Show
Stefan Holdermans
stefan at cs.uu.nl
Thu Dec 8 09:04:53 EST 2005
Ben,
>>>> data State
>>>> = Start
>>>>
>>>> | Stop
>>>> | forall a . (Show a, Eq a) => State a
>
> But this is a rank-2 type, not an existentially quantified type?
No, this one really is an existentially quantified type.
An example of a data constructor with a rank-2 type would be, f.i.:
data State = ...
| State (forall a . (Show a, Eq a) => a)
Here we have
State :: (forall a . (Show a, Eq a) => a) -> State
while in the existentially quantified case we had
State :: forall a . (Show a, Eq a) => a -> State
which has rank 1.
(The rank-2 example does not make much sense, however, for the only
value that can be passed to State is bottom. But, hey, it's just an
example.)
Regards,
Stefan
More information about the Haskell-Cafe
mailing list