comonad-4.2.7.2: 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

(ComonadEnv e w, Monoid m) => ComonadEnv e (TracedT m w) Source |
(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) Source |
(Comonad w, Monoid m) => ComonadTraced m (TracedT m w) Source |
Monoid m => ComonadTrans (TracedT m) Source |
Monoid m => ComonadHoist (TracedT m) Source |
Functor w => Functor (TracedT m w) Source |
Applicative w => Applicative (TracedT m w) Source |
Distributive w => Distributive (TracedT m w) Source |
(ComonadApply w, Monoid m) => ComonadApply (TracedT m w) Source |
(Comonad w, Monoid m) => Comonad (TracedT m w) 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