[Haskell-cafe] What I wish someone had told me...

Derek Elkins derek.a.elkins at gmail.com
Tue Oct 14 18:48:07 EDT 2008


On Wed, 2008-10-15 at 05:39 +0800, Lennart Augustsson wrote:
> I'm not advocating existential types in this case.  I rarely use them myself.
> I was just pointing out that the mechanism for doing the OO thing
> exists in Haskell too, albeit looking a little different.

In general, to encode OO you need quite a bit more than existentials.
As you are probably aware, there was a cottage industry in the mid to
late '90s working on encodings of OO languages into System F + foo
calculi.  They just about gave up on a complete encoding until someone
figured one out.  'turns out all you needed was recursive bounded
existential quantification.  Of course, the encoding wasn't any fun to
use.  There are two morals that you can take out of this.  Either:
classes/objects are a conflation of ideas that might be more profitably
separated apart, or: OO is best approached on its own terms.

> I don't think there's anything weird about existential types, except
> an unfamiliar name.

Agreed.  I'm extremely tired of the "I haven't heard this term therefore
it must be 'scary' and complicated and beyond me" attitude.  Such people
need to stop acting like five year old children.



More information about the Haskell-Cafe mailing list