[Haskell-cafe] The difference between ($) and application

Tom Pledger tpledger at ihug.co.nz
Tue Dec 14 02:52:00 EST 2004


oleg at pobox.com wrote:
[...]

>However, if we try
>
>>t2' = W $ id
>>
>we get an error:
>
>/tmp/t1.hs:13:
>    Inferred type is less polymorphic than expected
>	Quantified type variable `a' escapes
>	Expected type: (a -> a) -> b
>	Inferred type: (forall a1. a1 -> a1) -> W
>    In the first argument of `($)', namely `W'
>    In the definition of `t2'': t2' = W $ id
>
>Incidentally, Hugs -98 gives a quite bizarre error message
>
>	ERROR "/tmp/t1.hs":13 - Use of W requires at least 1 argument
>
This is also the reason we write

    runST (do ...)

instead of

    runST $ do ...

isn't it?




More information about the Haskell-Cafe mailing list