3 ms·
Similarly, other control flow constructs could emit their own monadic types: * A loop could evaluate to a generator that yields the value of each iteration seq
by Sharlin 4y ago
Similarly, other control flow constructs could emit their own monadic types:
* A loop could evaluate to a generator that yields the value of each iteration sequentially (the lazy list/nondeterministic monad)
* An `async` block would evaluate to a future as async functions in many languages already (the async monad)
* A `try` block could evaluate to a result type, where calling result-returning functions inside the block would break from the block in case of an error value (the try/either monad).