Typo in GHC user guide?
Graham Klyne
gk at ninebynine.org
Thu Oct 2 20:26:22 EDT 2003
I think there's a typo in section 7.3.12.3:
[[
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,
[--------------] [--------------] ... Repeated clause
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.
]]
#g
------------
Graham Klyne
GK at NineByNine.org
More information about the Haskell
mailing list