[Haskell-cafe] Usage of . and $

David House dmhouse at gmail.com
Wed Mar 7 16:16:16 EST 2007

On 07/03/07, Nicolas Frisby <nicolas.frisby at gmail.com> wrote:
> 1) Emacs does the counting for me
> 2) parens don't surprise me if I happen to use rank-2 types.
> i was bit enough times when learning why $ and runST don't like each
> other that I've grown averse of $. I also like thinking of building a
> composite function instead of sequencing applications--this has helped
> me see patterns in other places like writing monad transformer
> instances and other stuff, so maybe it's a good thing.

I don't use rank-2 types that often and when I do I'm aware of the
restriction on ($) and similar hofs. I tend to use ($) only when the
right-hand side gets very messy; a multiple-line do or similar. For

blah = fromMaybe $ do
  x <- blah1
  y <- blah2
  guard (x == f y)
  g x

The closing parenthesis would make things a little messy, so ($) is nice.

-David House, dmhouse at gmail.com

More information about the Haskell-Cafe mailing list