Control.Monad.Trans.Conts

adjunctions-4.3: Adjunctions and representable functors

Copyright | (C) 2011-2013 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | MPTCs, fundeps
Safe Haskell | Safe
Language | Haskell98

Control.Monad.Trans.Conts

Contents

- Continuation passing style
- Multiple-continuation passing style
- Multiple-continuation passing style transformer

Description

    Cont r ~ Contravariant.Adjoint (Op r) (Op r)
    Conts r ~ Contravariant.AdjointT (Op r) (Op r)
    ContsT r w m ~ Contravariant.AdjointT (Op (m r)) (Op (m r)) w

Synopsis

- type Cont r = ContsT r Identity Identity
- cont :: ((a -> r) -> r) -> Cont r a
- runCont :: Cont r a -> (a -> r) -> r
- type Conts r w = ContsT r w Identity
- runConts :: Functor w => Conts r w a -> w (a -> r) -> r
- conts :: Functor w => (w (a -> r) -> r) -> Conts r w a
- newtype ContsT r w m a = ContsT {
  - runContsT :: w (a -> m r) -> m r
  }
- callCC :: Comonad w => ((a -> ContsT r w m b) -> ContsT r w m a) -> ContsT r w m a

# Continuation passing style

type Cont r = ContsT r Identity Identity #

cont :: ((a -> r) -> r) -> Cont r a #

runCont :: Cont r a -> (a -> r) -> r #

# Multiple-continuation passing style

type Conts r w = ContsT r w Identity #

runConts :: Functor w => Conts r w a -> w (a -> r) -> r #

conts :: Functor w => (w (a -> r) -> r) -> Conts r w a #

# Multiple-continuation passing style transformer

newtype ContsT r w m a #

Constructors

ContsT |
Fields runContsT :: w (a -> m r) -> m r

Instances

Comonad w => MonadTrans (ContsT r w) # |
Methods lift :: Monad m => m a -> ContsT r w m a #
Comonad w => Monad (ContsT r w m) # |
Methods (>>=) :: ContsT r w m a -> (a -> ContsT r w m b) -> ContsT r w m b # (>>) :: ContsT r w m a -> ContsT r w m b -> ContsT r w m b # return :: a -> ContsT r w m a # fail :: String -> ContsT r w m a #
Functor w => Functor (ContsT r w m) # |
Methods fmap :: (a -> b) -> ContsT r w m a -> ContsT r w m b # (<$) :: a -> ContsT r w m b -> ContsT r w m a #
Comonad w => Applicative (ContsT r w m) # |
Methods pure :: a -> ContsT r w m a # (<*>) :: ContsT r w m (a -> b) -> ContsT r w m a -> ContsT r w m b # (*>) :: ContsT r w m a -> ContsT r w m b -> ContsT r w m b # (<*) :: ContsT r w m a -> ContsT r w m b -> ContsT r w m a #
Comonad w => Apply (ContsT r w m) # |
Methods (<.>) :: ContsT r w m (a -> b) -> ContsT r w m a -> ContsT r w m b # (.>) :: ContsT r w m a -> ContsT r w m b -> ContsT r w m b # (<.) :: ContsT r w m a -> ContsT r w m b -> ContsT r w m a #

callCC :: Comonad w => ((a -> ContsT r w m b) -> ContsT r w m a) -> ContsT r w m a #