top | item 40556929

(no title)

aodonnell2536 | 1 year 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?

discuss

order

chuckadams|1 year ago

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.