4 ms·
First, I'd like to say that my intention in this posting was just to give a rough analogy that would make monads a bit less scary for the non-haskellers. I shou
by nullzzz 15y ago
First, I'd like to say that my intention in this posting was just to give a rough analogy that would make monads a bit less scary for the non-haskellers. I should have stated that more clearly though.
Hoever, I stand corrected. Bash executes the commands in a very different way from the IO monad. Using pure functions like String -> String you'd get the similar effect in Haskell, just like you suggested.
That that would of course disable all side-effects from the "links in the chain". Which is in many cases desired, but that's not Bash though.
I guess I'd need to define a whole new Monad to emulate the way Bash operates. I'm not saying you should emulate it though.