3 ms·
How does being a monad intersect with scope i'm genuinely curious
by darby_nine 2y ago
How does being a monad intersect with scope i'm genuinely curious
- lalaithion 2y agoMonads allow representing which global values a function reads to or writes to in the type of the function.
- darby_nine 2y agoMonads do not imply global values or variables.
- anyfoo 2y agoBut the stated paradigm is one thing they allow. See the Reader, Writer, and State monads.
- yazzku 2y agoThe Random Monad in Haskell allows you to write pseudo-random code without caring where the prng comes from. It's only when the caller runs evalRand/runRand that it must provide the prng. So you can't possibly screw up the random code by sourcing a global prng even if you wanted to; rather, it's the caller that has full control over the prng. https://hackage.haskell.org/package/MonadRandom-0.1.3/docs/Control-Monad-Random.html https://hackage.haskell.org/package/MonadRandom-0.1.3/docs/C...