[Haskell-beginners] Right-associating infix application operators

Tom Hobbs tvhobbs at googlemail.com
Tue Jul 6 07:00:33 EDT 2010


In people's responses to my serialization questions, I've seen them using $.

I didn't know what it was so I've looked it up.  Can someone please confirm
my understanding of what it does, please?

According to http://en.wikibooks.org/wiki/Haskell/Practical_monads, after
the second code sample in the "Return Values" section, it seems to suggest
that $ is only used to avoid using so many brackets.  Which seems to make
sense, but looking at it's definition in Prelude I really can't see why it's
useful.

Yitz gave me the code;

fmap (runGet $ readNames n) $ L.hGetContents h

So can I rewrite this without the $ like this?

fmap (runGet (readNames n)) (L.hGetContents h)

Is there any additional benefit to using $ than just not having to write as
many brackets?

Thanks,

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100706/e772e9c1/attachment.html


More information about the Beginners mailing list