3 ms·
Stacking dollar signs is elegant to me f $ g $ h $ some expression etc
by whateveracct 4y ago
Stacking dollar signs is elegant to me
f
$ g
$ h
$ some expression etc
- bmacho 4y agoIf I'm not mistaken, it reads from bottom to top. I hated the function application direction my whole life, even in math (I read and write from left to right, so f applied to x should be x f, and g after that should be x f g), but it is ridiculously bad in Haskell. Transforming data, filtering and piping should be where it excels due to the lazy data structures, but bottom to top piping order is annoying.
- whateveracct 4y agoI prefer it, personally. Especially when pointfree. Way easier for me to read at a glance.
- azurelake 4y agoYou can use `>>>` from `Control.Arrow` to switch the order if you don't mind make your code more esoteric.
- whateveracct 4y agoControl.Arrow is in base at least :)
- nimih 4y agoThe & operator in Data.Function--which is just flipped $ with slightly higher, but still very low, operator precedence--at least gives you a way to deal with this in base; it's unfortunate it isn't more widely used in tutorials and example code (at least from what I've seen).