[Haskell-cafe] Really Simple explanation of Continuations Needed

Vinod Grover vinod.grover at gmail.com
Wed Oct 5 17:57:40 CEST 2011

On the general notion of continuations, I believe Matt Might's blog explains
it quite well using Javascript.


In the way of a simple example, he suggests that instead of writing

function id(x) {
  return x ;

a CPS version might write:

function id(x,ret) {
  ret(x) ;


IMO things appear confusing to newbies (it happened to me once too) when
people dont use intuitive names for obvious things like continuations

On Fri, Sep 30, 2011 at 11:42 PM, Mark Spezzano <
mark.spezzano at chariot.net.au> wrote:

> Hi,
> Can someone please give me a _lucid_ and  _simple_ explanation of exactly
> how continuations can be used in Haskell?
> I've already had a look at most of the tutorials and explanations on the
> web, but I'm still confused. Continuations and CPS have me baffled. (I have
> most of the Haskell textbooks and even these are sketchy on Continuations)
> I don't understand the notion of the Cont monad and how it can be used for
> multitasking, backtracking and interrupting computations. I understand that
> functions  take in a (continuation) function that represents the work
> remaining to do, but al of the explanations on the web and in technical
> papers seems to trip over themselves in explaining the fundamentals to a
> CPS-newbie.
> If anyone could explain such concepts to me in unambiguous, clear English
> then this would be very helpful.
> Thanks in advance for your help,
> Mark
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111005/ca357781/attachment.htm>

More information about the Haskell-Cafe mailing list