[Haskell-cafe] Language complexity & beginners

Kosyrev Serge _deepfire at feelingofgreen.ru
Tue Feb 9 11:27:44 UTC 2016


Michael Orlitzky <michael at orlitzky.com> writes:
> Most uses of "$" are for stupid
> things like "sin $ 1 + 2" where parentheses would be much more clear.

"$" simplifies visual perception through two factors:

  1. we are relieved from counting parentheses
  2. it serves as a cue to treat the entire remaining part until ")" as
     part of the same expression

Case in point (only slightly contrived) -- which one is easier to
visually parse to you:

  foo (thInt $ fromIntegral $ c2hsValueInt cexp) (thInt $ fromIntegral $ c2hsValueInt cexp)

  foo (thInt (fromIntegral (c2hsValueInt cexp))) (thInt (fromIntegral (c2hsValueInt cexp)))

Me, I get a blood pressure spike roughy here ---^

-- 
с уважениeм / respectfully,
Косырев Сергей


More information about the Haskell-Cafe mailing list