At 2002-03-14 16:10, Tom Bevan wrote: >I noticed that Ralf Hinze posted a CPS monad yesterday.
He did? Anyway I have one here: <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/hscheme/Source/C ontinuationPassing.hs?rev=HEAD&content-type=text/plain> Basically it's this: newtype CPS ex p a = MkCPS {unCPS :: (ex -> p) -> (a -> p) -> p}; 'ex' is exception, so that I can make it an instance of MonadError. >Would someone be kind enough to post a simple example of a function that >uses CPS. Once you've made it an instance of Monad, of course you can just use 'do' notation. But I use CPS here (for my Scheme interpreter) because you can do call-with-current-continuation. -- Ashley Yakeley, Seattle WA _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
