[Haskell-cafe] How to make callCC more dynamic

Ertugrul Soeylemez es at ertes.de
Wed Aug 24 18:54:16 CEST 2011

bob zhang <bobzhang1988 at gmail.com> 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 the semantics of the underlying monad.  More concretely
what you are implementing here is a codensity as you can find it in the
monad-ran package by Edward K.


nightmare = unsafePerformIO (getWrongWife >>= sex)

More information about the Haskell-Cafe mailing list