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

Eugene Kirpichov ekirpichov at gmail.com
Thu Nov 12 05:50:49 EST 2009


2009/11/12 Neil Brown <nccb2 at kent.ac.uk>:
> Eugene Kirpichov wrote:
>>
>> 2009/11/12 Andrew Coppin <andrewcoppin at btinternet.com>:
>>
>>>
>>> Even I am still not 100% sure how placing forall in different positions
>>> does
>>> different things. But usually it's not something I need to worry about.
>>> :-)
>>>
>>
>> To me it does not look like it does different things: everywhere it
>> denotes universal polymorphism. What do you mean? I might be missing
>> something.
>>
>
> I think what he means is that this:
>
> foo :: forall a b. (a -> a) -> b -> b
>
> uses ScopedTypeVariables, and introduces the type-name a to be available in
> the where clause of myid.  Whereas something like this:
>
> foo2 :: (forall a. a -> a) -> b -> b
>
> uses Rank2Types (I think?) to describe a function parameter that works for
> all types a.  So although the general concept is the same, they use
> different Haskell extensions, and one is a significant extension to the type
> system while the other (ScopedTypeVariables) is just some more descriptive
> convenience.
>

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.

> Thanks,
>
> Neil.
>



-- 
Eugene Kirpichov
Web IR developer, market.yandex.ru


More information about the Haskell-Cafe mailing list