Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-05 Thread Vinod Grover
On the general notion of continuations, I believe Matt Might's blog explains it quite well using Javascript. http://matt.might.net/articles/by-example-continuation-passing-style/ In the way of a simple example, he suggests that instead of writing function id(x) { return x ; } a CPS version

Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-02 Thread Heinrich Apfelmus
Ozgur Akgun wrote: On 1 October 2011 11:55, Yves Parès limestr...@gmail.com wrote: BTW Heinrich, the evalState (sequence . repeat . State $ \s - (s,s+1)) 0 at the end doesn't work anymore. It should be replaced by : evalState (sequence . repeat . StateT $ \s - Identity (s,s+1)) 0 Or

[Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Mark Spezzano
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

Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Heinrich Apfelmus
Mark Spezzano wrote: 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

Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Mark Spezzano
Hi Heinrich, I'm really looking to use the Cont monad itself--but the link you gave me is also helpful, so thank you. If anyone else has words of wisdom to add to this thread please feel free to pitch in. Thanks, Mark On 01/10/2011, at 5:08 PM, Heinrich Apfelmus wrote: Mark Spezzano

Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Yves Parès
Having worked with the operational-package, I only can recommend it. In fact I was trying to do the same thing you are now. The only thing is that operational needs the use of GADTs, which come as an extension, but still are a useful and heavily used feature. BTW Heinrich, the evalState

Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread Ozgur Akgun
Hi. On 1 October 2011 11:55, Yves Parès limestr...@gmail.com wrote: BTW Heinrich, the evalState (sequence . repeat . State $ \s - (s,s+1)) 0 at the end doesn't work anymore. It should be replaced by : evalState (sequence . repeat . StateT $ \s - Identity (s,s+1)) 0 Or equivalently:

Re: [Haskell-cafe] Really Simple explanation of Continuations Needed

2011-10-01 Thread wren ng thornton
Hello, Oleg has a introduction for delimited continuations which he presented during ICFP: http://okmij.org/ftp/continuations/index.html#tutorial Of course, it's worth mentioning that the Cont monad is actually doing delimited continuations, cf.: