Existential Typing (was Multi-parameter OOP)
Simon Peyton-Jones
simonpj@microsoft.com
Wed, 24 Oct 2001 09:32:30 -0700
| If GHC had true existential typing, as opposed to just=20
| existential datatypes,=20
| you could reasonably code what I think you want like this:
|=20
| class A a where
| basicA :: Bool
| nextA :: a -> (EX a'. A a' =3D> a')
| basicA =3D True
| nextA =3D id
Curiously enough, this thread intersects with the "higher-ranked
types" thread on the Haskell list. If I do implement the Odersky/Laufer
higher-ranked types inference mechanism, then I'll also allow
existentials
in arbitrary positions. =20
The elimination of "stupid" existential wrapper constructors
is discussed in a bit more detail in the paper Mark and I wrote
recently:
First class modules for Haskell
=09
http://research.microsoft.com/~simonpj/papers/first-class-modules/index.
htm
Simon