[Haskell-cafe] Re: Can we come out of a monad?

Ertugrul Soeylemez es at ertes.de
Tue Aug 10 03:40:02 EDT 2010


"Edward Z. Yang" <ezyang at MIT.EDU> wrote:

> Excerpts from Ertugrul Soeylemez's message of Tue Aug 10 02:31:14 -0400 2010:
> > There is no evalCont, there is runCont:
> >
> >   runCont :: (a -> r) -> Cont r a -> r
> >
> > Note that Cont/ContT computations result in a value of type 'r':
> >
> >   newtype Cont r a = Cont ((a -> r) -> r)
>
> Yes, but if you pass in 'id' as the continuation to 'runCont', the
> entire expression will result in 'a'.  The continuation monad doesn't
> act globally...

Then you can only run evalCont, if r = a, which makes that function
quite pointless:

  evalCont :: Cont r r -> r
  evalCont = runCont id


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/




More information about the Haskell-Cafe mailing list