Arthur Baars asks:

> It there a reason why existential quantification does not work with a
> newtype, or is it just
> a parser problem?

>From the manual, section 7.12.3 "Restrictions":

--8<--
You can't use existential quantification for newtype declarations. So this is illegal: 
          newtype T = forall a. Ord a => MkT a

Reason: a value of type T must be represented as a pair of a
dictionary for Ord t and a value of type t. That contradicts the idea
that newtype should have no concrete representation. You can get just
the same efficiency and effect by using data instead of newtype. If
there is no overloading involved, then there is more of a case for
allowing an existentially-quantified newtype, because the data because
the data version does carry an implementation cost, but single-field
existentially quantified constructors aren't much use. So the simple
restriction (no existential stuff on newtype) stands, unless there are
convincing reasons to change it.
--8<--

HTH.

--KW 8-)

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to