[Haskell-cafe] Is my code too complicated?
andrewcoppin at btinternet.com
Sat Jul 3 09:48:38 EDT 2010
Ivan Lazar Miljenovic wrote:
> Stephen Tetley <stephen.tetley at gmail.com> writes:
>> On 3 July 2010 14:20, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
>>> Tangentally, it seems to me that all monads can be described as doing zero
>>> or more of:
>>> - Invisibly pass state around (and possibly modify it).
>>> - Perform unusual flow control.
> What do you consider "unusual"?
Not the usual flow control that you'd implement by simply chaining
vanilla functions together.
Maybe and similar error monads implement early exit. List and similar
containers implement multiple execution in some order or other. There
are monads that implement choice. Cont implements... uh, everything?
Even STM, which is largely about state mutation, implements [very]
unusual flow control - the flow is controlled by other concurrent threads!
More information about the Haskell-Cafe