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

Sean Leather leather at cs.uu.nl
Thu Nov 12 17:59:50 EST 2009


> I just meant it's not immediately clear how
>
>  foo :: forall x. (x -> x -> y)
>
> is different from
>
> foo :: (forall x. x -> x) -> y
>
> It takes a bit of getting used to.


Those are different functions all together, so perhaps you meant these.

  foo :: forall x y. (x -> x) -> y
  bar :: forall y. (forall x . x -> x) -> y

While neither function is seemingly useful, the second says that the
higher-order argument must be polymorphic. I see two options:

  bar id
  bar undefined

The first has these and many more:

  foo (+1)
  foo show
  foo ($)
  ...

Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091112/33cbec39/attachment.html


More information about the Haskell-Cafe mailing list