Control.Comonad.Trans.Traced

comonad-5: 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 #

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

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

# Traced comonad transformer

newtype TracedT m w a #

Constructors

TracedT |
Fields runTracedT :: w (m -> a)

Instances

(ComonadEnv e w, Monoid m) => ComonadEnv e (TracedT m w) # |
Methods ask :: TracedT m w a -> e #
(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) # |
Methods pos :: TracedT m w a -> s # peek :: s -> TracedT m w a -> a # peeks :: (s -> s) -> TracedT m w a -> a # seek :: s -> TracedT m w a -> TracedT m w a # seeks :: (s -> s) -> TracedT m w a -> TracedT m w a # experiment :: Functor f => (s -> f s) -> TracedT m w a -> f a #
(Comonad w, Monoid m) => ComonadTraced m (TracedT m w) # |
Methods trace :: m -> TracedT m w a -> a #
Monoid m => ComonadTrans (TracedT m) # |
Methods lower :: Comonad w => TracedT m w a -> w a #
ComonadHoist (TracedT m) # |
Methods cohoist :: (Comonad w, Comonad v) => (forall x. w x -> v x) -> TracedT m w a -> TracedT m v a #
Functor w => Functor (TracedT m w) # |
Methods fmap :: (a -> b) -> TracedT m w a -> TracedT m w b # (<$) :: a -> TracedT m w b -> TracedT m w a #
Applicative w => Applicative (TracedT m w) # |
Methods pure :: a -> TracedT m w a # (<*>) :: TracedT m w (a -> b) -> TracedT m w a -> TracedT m w b # (*>) :: TracedT m w a -> TracedT m w b -> TracedT m w b # (<*) :: TracedT m w a -> TracedT m w b -> TracedT m w a #
Distributive w => Distributive (TracedT m w) # |
Methods distribute :: Functor f => f (TracedT m w a) -> TracedT m w (f a) # collect :: Functor f => (a -> TracedT m w b) -> f a -> TracedT m w (f b) # distributeM :: Monad m => m (TracedT m w a) -> TracedT m w (m a) # collectM :: Monad m => (a -> TracedT m w b) -> m a -> TracedT m w (m b) #
(ComonadApply w, Monoid m) => ComonadApply (TracedT m w) # |
Methods (<@>) :: TracedT m w (a -> b) -> TracedT m w a -> TracedT m w b # (@>) :: TracedT m w a -> TracedT m w b -> TracedT m w b # (<@) :: TracedT m w a -> TracedT m w b -> TracedT m w a #
(Comonad w, Monoid m) => Comonad (TracedT m w) # |
Methods extract :: TracedT m w a -> a # duplicate :: TracedT m w a -> TracedT m w (TracedT m w a) # extend :: (TracedT m w a -> b) -> TracedT m w a -> TracedT m w b #

# Operations

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 #