News for hackers. Stuff that matters.
Re:The Meaning of Monad in MonadTrans by cryptonector on Monday August 14, 2023 @12:44AM (#37117548)
Yes! Consider jq. jq is almost a 100% pure functional programming language [0], and it's a lot like using the list monad in Haskell.

Various monads basically help you manage things like configuration parameters that affect your computations. Your code can all be deterministic, and yet using a monad can help you write cleaner code.

Just because the IO monad is used for impure actions doesn't mean that monads in general are used for impure actions.

[0] There are a few builtins that have side-effects: `input` and `inputs` (which consume inputs), and then there's `stderr` and `debug` (which emit output to `stderr`). Other than this, every jq program represents a pure transformation of its input.

There are no comments on this comment yet.