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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to