Do you wonder how IO monad implementation works under the hood? I did, so, as a learning exercise, I implemented the very basic IO monad from scratch.
I took inspiration from the Demystifying functional effect systems in Scala article by Dmitry Karlinsky and the How do Fibers Work? A Peek Under the Hood talk by Fabio Labella.
- stack safety
- exception handling
- error recovery
- support for parallelism and concurrency by shifting the execution to a different execution context and by forking the run loop aka creating a fiber