Re: [Haskell-cafe] How to make callCC more dynamic

2011-08-26 Thread oleg
> ContT {runContT :: forall r1 . (forall r2 . a-> m r2) -> m r1} > callCC can be defined, however, you can not run it, and reset couldn't > type check Indeed you cannot. As the articles http://okmij.org/ftp/continuations/undelimited.html explain, the answer of _undelimited_ continuation

Re: [Haskell-cafe] How to make callCC more dynamic

2011-08-26 Thread bob zhang
Thank you, there is also a nice link here :-) http://stackoverflow.com/questions/7178919/how-to-make-callcc-more-dynamic and for this type, ContT {runContT :: forall r1 . (forall r2 . a-> m r2) -> m r1} callCC can be defined, however, you can not run it, and reset couldn't type check 于 11-8-25 上午1:

Re: [Haskell-cafe] How to make callCC more dynamic

2011-08-25 Thread Ertugrul Soeylemez
bob zhang wrote: > I was curious that we could bring really continuations into haskell, > the traditional callCC brings a lot of unnecessary type restrictions That's where the misconception lies. The type parameter /is/ necessary for delimited continuations in Haskell. By the way, I don't se

Re: [Haskell-cafe] How to make callCC more dynamic

2011-08-24 Thread oleg
bob zhang wrote: > 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 ::

Re: [Haskell-cafe] How to make callCC more dynamic

2011-08-24 Thread bob zhang
Hi Jason, thanks for your reply. I was curious that we could bring really continuations into haskell, the traditional callCC brings a lot of unnecessary type restrictions On Wed, Aug 24, 2011 at 12:45 PM, Jason Dagit wrote: > On Wed, Aug 24, 2011 at 9:19 AM, bob zhang wrote: > > Hi, all > > I

Re: [Haskell-cafe] How to make callCC more dynamic

2011-08-24 Thread Ertugrul Soeylemez
bob zhang wrote: > I thought the right type for ContT should be > newtype ContT m a = ContT {runContT :: forall r. (a-> m r) -> m r} No, that will effectively make it impossible to make use of CPS effects, hence turning your ContT into an IdentityT-like monad transformer, which can only change t

Re: [Haskell-cafe] How to make callCC more dynamic

2011-08-24 Thread Jason Dagit
On Wed, Aug 24, 2011 at 9:19 AM, bob zhang 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 :: Mo

[Haskell-cafe] How to make callCC more dynamic

2011-08-24 Thread bob zhang
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