[Haskell-cafe] Intuition to understand poor man's concurrency

Heinrich Apfelmus apfelmus at quantentunnel.de
Wed Jul 30 08:47:31 UTC 2014

martin wrote:
> I am trying to understand the ideas of Koen Klaessen, published in
> Functional Pearls: "A poor man's concurrency" (1993).
> The code in the paper doesn't compile. E.g. uses "lambda dot" instead
> of "labmda arrow", i.e. the way the labmda calculus guys write
> things. Was that ever legal haskell or is this the result of some
> lhs2lex pretty printer?
> Anyways, I believe I was able to convert that into modern haskell
> syntax - at least it compiles. But I have trouble to understand the
> Monad instance presented there. Could anyobody walk me through the
> bind function?
> But even more important: how do you guys develop an intuition about
> what the bind operator does in a specific monad.

I find it very helpful to think of monads as "lists of instructions". I
have written a thorough and hopefully accessible explanation here


which also discusses a transparent implementation Koen Classen's parser

 From this point of view, the continuation monad corresponds to a
particular list implementation, namely "difference lists". If you have 
trouble understanding the continuation monad, I would recommend to go 
via the "list of instructions" route, as it involves only functions of a 
less higher order.

Best regards,
Heinrich Apfelmus


More information about the Haskell-Cafe mailing list