simple question

Dean Herington heringtonlacey at mindspring.com
Sat Apr 2 16:08:28 EST 2005


At 10:56 PM +0200 4/2/05, Benjamin Franksen wrote:
>On Saturday 02 April 2005 22:29, Peter Hercek wrote:
>>  What is $ function good for?
>
>Mostly for avoiding parentheses. $ is right associative and has lowest
>precedence, whereas normal application is left associative and binds most
>tightly:
>
>    f $ g $ h x === f ( g ( h x ) )
>
>There are more advanced uses of $ but I'll let others elaborate on that.
>
>Ben

The other main use is to have a name for function application.  For example,

zipWith ($) [sin, cos, tan] [0, 1, 2]

Dean


More information about the Glasgow-haskell-users mailing list