Simon Peyton-Jones wrote:
When attempting to reconstruct the syntax for existential
quantification, I tried:
newtype Groo a = Groo (Either a b)
To my surprise, using ghc-4.00, this worked - without even using
`-fglasgow-exts'. (it doesn't work, with or without `-fglasgow-exts'
under 3.02)
Nothing about existentials here. GHC is universally quantifying
over the 'b'. It's just as if you'd written
newtype Groo a = Groo (forall b. Either a b)
Indeed - it wasn't the type I was casting about for - I was looking for
how to express:
newtype Groo a = forall b. Groo (Either a b)
This form of quantification seems to only be supported for `data' decls -
is there a reason we can't also do it with `newtype'?
Perhaps we shouldn't do implicit universal quantification here?
Is this a feature or a bug?
The confusion on my part was that this form of implicit universal
quantification seems to be an undocumented feature. In the release notes,
the only comment about implicit quantification is this:
Notice that you don't need to use a forall if there's an
explicit context. For example in the first argument of the
constructor MkSwizzle, an implicit "forall a." is prefixed to
the argument type. The implicit forall quantifies all type
variables that are not already in scope, and are mentioned in
the type quantified over
--Jeff