[Haskell-cafe] What does the `forall` mean ?

Eugene Kirpichov ekirpichov at gmail.com
Thu Nov 12 14:57:38 EST 2009

2009/11/12 Ryan Ingram <ryani.spam at gmail.com>:
> On Thu, Nov 12, 2009 at 2:50 AM, Eugene Kirpichov <ekirpichov at gmail.com> wrote:
>> But that's not an issue of semantics of forall, just of which part of
>> the rather broad and universal semantics is captured by which language
>> extensions.
> The forall for existential type quantification is wierd.
>> data Top = forall a. Any a   -- existential
>> data Bottom = All (forall a. a) -- rank 2

Hm, you're right. I didn't even remember you could define existential
types without GADT syntax.

I also find the GADT syntax much better for teaching people what an ADT is.

> I think it makes much more sense in GADT syntax:
>> data Top where
>>    Any :: forall a. a -> Top
>> data Bottom where
>>    All :: (forall a. a) -> Bottom
> where it's clear the forall is scoping the type of the constructor.
>  -- ryan

Eugene Kirpichov
Web IR developer, market.yandex.ru

More information about the Haskell-Cafe mailing list