4 ms·
The example often used is something like the Reader monad, which is basically used like dependency injection. Run your code in an isolated environment to test,
by joppy 7y ago
The example often used is something like the Reader monad, which is basically used like dependency injection. Run your code in an isolated environment to test, and connect it to the real application just by swapping the environment (effects/monad).
A more interesting example could be monads as used in Haxl, which give an alternative monad in which to run database queries, which can perform complicated batching of requests behind the scenes with no change of business logic code.