News for hackers. Stuff that matters.
Re:Optional If Expressions by Sharlin on Saturday April 15, 2023 @03:47AM (#35578544)
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).

There are no comments on this comment yet.