[Haskell-beginners] the ($) function (was desugaring an example from RWH)

Michael Easter codetojoy at gmail.com
Mon Feb 23 13:18:19 EST 2009

re: desugaring.  Thanks Andrew, that worked great!

I have another, easier question from the same code in RWH:

bogusTransfer qty fromBal toBal = do
    fromQty <- atomically $ readTVar fromBal

Can someone please explain the ($) function in English? From the type
signature, it seems to be an "apply function", but I can't quite explain
when we use it. Clearly, it is used throughout RWH but I haven't found a
good explanation.

My guess is that it is when we want an "execution" of a function rather than
a mere reference to it. Is that accurate?

thanks again

Michael Easter
http://codetojoy.blogspot.com: Putting the thrill back in blog

http://youtube.com/ocitv -> Fun people doing serious software engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090223/12b940d4/attachment.htm

More information about the Beginners mailing list