Hi Tom,
There are no additional benifits to the '$' function - you pretty much have it.
Wait - one more. It can be used as a 'section' like any other binary operator, so ($ 4) :: (Int -> a) -> a. But that doesn't come up a whole lot. This is much like how (* 5) 6 == 30.
Antoine
On Jul 6, 2010 6:00 AM, "Tom Hobbs" <tvhobbs@googlemail.com> wrote: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
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners