atom feed20 messages in org.haskell.haskell-primeRe: Proposal: Deprecate ExistentialQu...
FromSent OnAttachments
Niklas BrobergJun 27, 2009 3:44 am 
Isaac DupreeJun 27, 2009 7:51 am 
Malcolm WallaceJun 27, 2009 11:55 am 
Niklas BrobergJun 27, 2009 12:37 pm 
Stefan HoldermansJun 28, 2009 12:43 am 
John MeachamJun 28, 2009 1:35 am 
Niklas BrobergJun 28, 2009 3:17 am 
Stefan HoldermansJun 28, 2009 3:23 am 
Niklas BrobergJun 28, 2009 3:32 am 
Stefan HoldermansJun 28, 2009 3:47 am 
Niklas BrobergJun 28, 2009 4:17 am 
Niklas BrobergJun 28, 2009 4:19 am 
Stefan HoldermansJun 28, 2009 4:24 am 
Niklas BrobergJun 28, 2009 4:31 am 
Svein Ove AasJun 28, 2009 2:21 pm 
Simon Peyton-JonesJun 29, 2009 12:42 am 
Niklas BrobergJul 23, 2009 4:47 am 
Iavor DiatchkiJul 23, 2009 9:25 am 
Sittampalam, GaneshJul 23, 2009 9:36 am 
Iavor DiatchkiJul 23, 2009 3:27 pm 
Subject:Re: Proposal: Deprecate ExistentialQuantification
From:Niklas Broberg (
Date:Jun 28, 2009 4:17:20 am

I agree. But ;-) since it's obvious not possible to get rid of the classic syntax completely, I see no harm in having it support existentials and GADTs as well. In an ideal word, in which there wasn't a single Haskell program written yet, I'd indeed like to throw the classic syntax out altogether.

Ah, but there's the thing. The classic syntax *doesn't* support existentials and GADTs, if by classic you mean Haskell 98. You need a separate syntactic extension, and the one we have is ad-hoc and unintuitive (the whole universal vs existential quantification thing is awkward), not to mention ugly. There's simply no sense to a declaration reading e.g.

data Foo = forall a . (Show a) => Foo a

The entities on the right-hand side of that declaration come in the wrong order, intuitively. What you really want or mean when you use the classic syntax with existential quantification is

data Foo = Foo (exists a . (Show a) => a)

Having that would make a lot more sense, and would fit well together with the intuition of the classic syntax. If we wanted to keep support for existential quantification together with the classic style, that should IMNSHO be the way to do it. But for various reasons (like not wanting to steal another keyword) we don't do it that way. Instead we have a syntax that is meant to be understood as "constructor Foo has the type forall a . (Show a) => a". But that's exactly what we would express with the GADT-style syntax! :-)