4 ms·
I think there's also the issue that they're a lot less convenient without built-in syntax (or macros). Haskell's do-notation makes >> look like a newline and >>
by Zak 16y ago
I think there's also the issue that they're a lot less convenient without built-in syntax (or macros). Haskell's do-notation makes >> look like a newline and >>= look like an assignment. Without this syntactic sugar, monadic code rarely looks like an elegant solution.
- jrockway 16y agoWithout this syntactic sugar, monadic code rarely looks like an elegant solution. I'm not sure this is widely agreed-upon. Here's what a program composed of pure functions looks like: quux = baz . bar . foo This is a function of one argument that filters the input through foo, then bar, then baz. Just like UNIX pipes, but backwards. Now let's try it with monads: quux = baz =<< bar =<< foo Same thing; this is a function of one argument, one that passes that argument through foo, then bar, then baz. >>= notation is quite elegant. do notation just makes functional programing look imperative.