Bash is just a Monad
haskellrescue.blogspot.com
haskellrescue.blogspot.com
Bash runs the commands of a pipeline in parallel, so you don't get the sequencing of side-effects that monads provide. You'd better off saying that shell commands are plain functions (mapping stdin to stdout) than insisting they're Kleisli arrows.
But to play along with the conceit: the pipe operator would translate into the >=> operator, not >>=. The first command in the pipeline has a stdin, it's just that usually the first command in a pipeline is one that ignores its stdin.
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.