[Haskell] is $ a no-op?

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Wed Oct 13 09:55:14 EDT 2004

In a *lot* of places in my programs,
I am using notation   f $ g $ h x  in favour of  f (g (h x))
(that's the  '$'  as defined in  the Prelude:
right-associating infix application operator)
as it avoids parentheses, and makes the code more manageable
(you can write "(upward) pipes" with one "$ f" per line, etc)

I liked to think of it as just a syntactical convention (for years ...)
but is it really at no cost? It does introduce extra function calls,
that is, extra closures etc.? Can these be removed by ghc's optimizer?

Or am I totally wrong here ... Actually, looking at the Prelude (now),
there is '$!' as well - is that supposed to answer my question?
-- Johannes Waldmann,  Tel/Fax: (0341) 3076 6479 / 6480 --
------ http://www.imn.htwk-leipzig.de/~waldmann/ ---------

More information about the Haskell mailing list