[Haskell-cafe] Re: [Haskell] pros and cons of static typing and side effects ?

Keean Schupke k.schupke at imperial.ac.uk
Tue Aug 16 16:29:47 EDT 2005


Benjamin Franksen wrote:

>On Tuesday 16 August 2005 21:56, Keean Schupke wrote:
>  
>
>>You can even use existential types to create lists of things with a
>>common interface, where you do not know in advance what types you may
>>need:
>>
>>    data XWrap = XWrap (forall a . Show a => a)
>>    type ListXWrap = [XWrap]
>>    
>>
>
>You probably meant to write
>
>    data XWrap = forall a . Show a => XWrap a
>
>or, in GADT style (which I find a bit more intuitive here):
>
>    data XWrap where
>      XWrap :: Show a => a -> XWrap
>
>  
>
Yes I always get confused by the notation Haskell uses... I used explicit
universal quantification by mistake. I tried to think logically about 
the encapsulation
existential types represent - and got the wrong form.

I for one would like to see the use of 'exists' as a keyword for 
existential types, after
all different symbols are used in modal logic (upside-down-A for forall, 
and backwards-E
for exists).

    Regards,
    Keean.


More information about the Haskell-Cafe mailing list