According to Wikipedia, the following code should compile,
{-# LANGUAGE RankNTypes #-}
data T = MkT (exists a. Show a => a)
But, I'm not having any luck. ghci 7.2.2 complains with,
test.hs:2:23:
Illegal symbol '.' in type
Perhaps you intended -XRankNTypes or similar flag
to enable explicit-forall syntax: forall <tvs>. <type>
Failed, modules loaded: none.
The original link is here: http://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types
Thanks in advance!
The page you linked mentions that
exists
as a keyword doesn't exist but that you can get the same behavior usingforall
. Note that your particular example is captioned "(psuedo) haskell".They say it would be equivalent to:
with