[Haskell-cafe] Why is "Cont" out of scope?

Brandon Allbery allbery.b at gmail.com
Wed Apr 3 04:15:01 CEST 2013


On Tue, Apr 2, 2013 at 8:37 PM, Daryoush Mehrtash <dmehrtash at gmail.com>wrote:

> I am trying to use the Cont in Control.Monad.Cont but it seems to be
> missing
>
> Prelude> import Control.Monad.Cont
> Prelude Control.Monad.Cont> :t Cont
>
>
It's gone; try "cont" (lowercase).

mtl2 replaced the old standalone monads with monad transformers over the
Identity monad (so Cont is a type alias for ContT Identity); however, it's
not possible to create data constructors for type aliases, so the Cont data
constructor is gone and a "cont" smart constructor has taken its place.

    Prelude Control.Monad.Cont> :t cont
    cont :: ((a -> r) -> r) -> Cont r a

The same is true of State, Reader, and Writer.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130402/fc84e82a/attachment.htm>


More information about the Haskell-Cafe mailing list