Existentials

Simon Peyton-Jones simonpj@microsoft.com
Thu, 17 Apr 2003 09:02:45 +0100


Dear GHC users, Hugs users, and Hugs implementors

Many of you have grown to love existential data types, which we current
write like this:

	data T =3D forall a. Foo a (a -> Int)

Mark and I chose 'forall' rather than 'exists' to save grabbing another
keyword from the programmer.  And indeed, the type of the constructor
Foo is
	Foo :: forall a. a -> (a->Int) -> T

But every single time I explain this to someone, I find I have to make
excuses for using the term 'forall'.  I say "it really means 'exists',
but we didn't want to lose another keyword".=20

I have gradually concluded that our decision was a mistake.  (In
fairness to Mark, I think I was the primary advocate for it.)  I reckon
that we should

	Allow 'exists'=09
	Deprecate 'forall' (for defining existentials, that is)
	Eventually allow only 'exists'


Does anyone have any opinions on this topic?  It's a small point, but
one that bites quite frequently.  It might even be possible to arrange
that 'forall' and 'exists' were only keywords in types, and not in
terms, but I'm not sure it's worth the bother.

I don't think it affects NHC, because it's not H98 anyway.


Simon