[Haskell-cafe] How to make callCC more dynamic

Jason Dagit dagitj at gmail.com
Wed Aug 24 18:45:02 CEST 2011


On Wed, Aug 24, 2011 at 9:19 AM, bob zhang <bobzhang1988 at gmail.com> wrote:
> Hi, all
> I thought the right type for ContT should be
> newtype ContT m a = ContT {runContT :: forall r. (a-> m r) -> m r}
> and
> other control operators
> shift :: Monad m => (forall r . (a-> ContT m r) -> ContT m r) -> ContT m a
> reset :: Monad m => ContT m a -> ContT m a
> callCC :: ((a-> (forall r . ContT m r)) -> ContT m a) -> ContT m a
>
> unfortunately, I can not make callCC type check, and don't know how to
> do it.
> I managed to make shift, reset type check

Correct me if I'm wrong, but you're wanting to implement the delimited
form of continuations?

If so, you might take a look at this and the associated papers:
http://hackage.haskell.org/package/CC-delcont

Jason



More information about the Haskell-Cafe mailing list