|
|
|
|
|
by ElectricalUnion
941 days ago
|
|
From my limited knowledge of FP languages it is expected that pure code in fact doesn't evaluate anything until a monad forces it to evaluate. You would then need a monad to evaluate the things you're attempting to log. And at that point you have a monad, so you can log as usual? |
|
Monads and side-effects aren't intrinsically related. Simplifying, a monad is something with flatMap() - in JavaScript, Array and Promise are monads (kinda). What flatMap() gives you is the ability to chain things, which is useful to sequence side-effects so that they can be performed by a machine in a given order. That's why IO and Eff are monads.