
On Tue, Feb 09, 2016 at 02:27:44PM +0300, Kosyrev Serge wrote:
Michael Orlitzky
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)))
My readability problem with this statement is line length. How about: foo (thInt (fromIntegral (c2hsValueInt cexp))) (thInt (fromIntegral (c2hsValueInt cexp))) I apologize for playing syntax golf, but I do want to cast a small vote for preferring parentheses over ($). It is this preference that makes me side with Orlitzky's argument that the type of ($) is irrelevant for beginners, since beginners should be encouraged to use parentheses anyways. It's One Less Thing To Worry About(tm).