Hacker News new | ask | show | jobs
by aodonnell2536 741 days ago
Would it then follow that commands/builtins like `time` and `sudo` are monads? What about shell commands in general, since you can always chain together stdout to stdin with pipes?
1 comments

Streams are definitely monads, so if you're reading lines from stdin and printing zero or more lines for each to stdout, you basically have a List monad (Haskell's laziness makes every list a poor man's stream, though if you're doing serious streaming work, you'd probably want something more specialized).

Mind you, shell pipes aren't actually implemented monadically, but you can certainly visualize it that way when working with functional libraries.