comonad-5.0.8: Comonads

Copyright | (C) 2008-2014 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Control.Comonad.Trans.Traced

Contents

- Traced comonad
- Traced comonad transformer
- Operations

Description

The trace comonad builds up a result by prepending monoidal values to each other.

This module specifies the traced comonad transformer (aka the cowriter or exponential comonad transformer).

Synopsis

- type Traced m = TracedT m Identity
- traced :: (m -> a) -> Traced m a
- runTraced :: Traced m a -> m -> a
- newtype TracedT m w a = TracedT {
  - runTracedT :: w (m -> a)
  }
- trace :: Comonad w => m -> TracedT m w a -> a
- listen :: Functor w => TracedT m w a -> TracedT m w (a, m)
- listens :: Functor w => (m -> b) -> TracedT m w a -> TracedT m w (a, b)
- censor :: Functor w => (m -> m) -> TracedT m w a -> TracedT m w a

# Traced comonad

type Traced m = TracedT m Identity Source #

traced :: (m -> a) -> Traced m a Source #

runTraced :: Traced m a -> m -> a Source #

# Traced comonad transformer

newtype TracedT m w a Source #

Constructors

TracedT |

Fields

- runTracedT :: w (m -> a)

#### Instances

Instances details

(ComonadEnv e w, Monoid m) => ComonadEnv e (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Env.Class Methods ask :: TracedT m w a -> e Source #
(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Store.Class Methods pos :: TracedT m w a -> s Source # peek :: s -> TracedT m w a -> a Source # peeks :: (s -> s) -> TracedT m w a -> a Source # seek :: s -> TracedT m w a -> TracedT m w a Source # seeks :: (s -> s) -> TracedT m w a -> TracedT m w a Source # experiment :: Functor f => (s -> f s) -> TracedT m w a -> f a Source #
(Comonad w, Monoid m) => ComonadTraced m (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Traced.Class Methods trace :: m -> TracedT m w a -> a Source #
ComonadHoist (TracedT m) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods cohoist :: (Comonad w, Comonad v) => (forall x. w x -> v x) -> TracedT m w a -> TracedT m v a Source #
Monoid m => ComonadTrans (TracedT m) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods lower :: Comonad w => TracedT m w a -> w a Source #
Applicative w => Applicative (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods pure :: a -> TracedT m w a Source # (<*>) :: TracedT m w (a -> b) -> TracedT m w a -> TracedT m w b Source # liftA2 :: (a -> b -> c) -> TracedT m w a -> TracedT m w b -> TracedT m w c Source # (*>) :: TracedT m w a -> TracedT m w b -> TracedT m w b Source # (<*) :: TracedT m w a -> TracedT m w b -> TracedT m w a Source #
Functor w => Functor (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods fmap :: (a -> b) -> TracedT m w a -> TracedT m w b Source # (<$) :: a -> TracedT m w b -> TracedT m w a Source #
(Comonad w, Monoid m) => Comonad (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods extract :: TracedT m w a -> a Source # duplicate :: TracedT m w a -> TracedT m w (TracedT m w a) Source # extend :: (TracedT m w a -> b) -> TracedT m w a -> TracedT m w b Source #
(ComonadApply w, Monoid m) => ComonadApply (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods (<@>) :: TracedT m w (a -> b) -> TracedT m w a -> TracedT m w b Source # (@>) :: TracedT m w a -> TracedT m w b -> TracedT m w b Source # (<@) :: TracedT m w a -> TracedT m w b -> TracedT m w a Source #
Distributive w => Distributive (TracedT m w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods distribute :: Functor f => f (TracedT m w a) -> TracedT m w (f a) Source # collect :: Functor f => (a -> TracedT m w b) -> f a -> TracedT m w (f b) Source # distributeM :: Monad m0 => m0 (TracedT m w a) -> TracedT m w (m0 a) Source # collectM :: Monad m0 => (a -> TracedT m w b) -> m0 a -> TracedT m w (m0 b) Source #
FunctorWithIndex i w => FunctorWithIndex (s, i) (TracedT s w) Source # |
Instance details Defined in Control.Comonad.Trans.Traced Methods imap :: ((s, i) -> a -> b) -> TracedT s w a -> TracedT s w b Source #

# Operations

trace :: Comonad w => m -> TracedT m w a -> a Source #

listen :: Functor w => TracedT m w a -> TracedT m w (a, m) Source #

listens :: Functor w => (m -> b) -> TracedT m w a -> TracedT m w (a, b) Source #

censor :: Functor w => (m -> m) -> TracedT m w a -> TracedT m w a Source #