Module
Control.Comonad.Transformerless.Traced
- Package
- purescript-transformerless
- Repository
- thimoteus/purescript-transformerless
#Traced Source
newtype Traced m a
Constructors
Traced (m -> a)
Instances
Newtype (Traced w a) _
Functor (Traced m)
(Semigroup m) => Extend (Traced m)
- Law: extend f <<< extend g = extend (f <<< extend g)
- Proof:
- Rewrite pointfully:
- (extend f <<< extend g) x = extend (f <<< extend g) x
- LHS := extend f (extend g x) =
- extend f (\ t -> g \ t' -> x (t <> t')) =
- \ s -> f (\ s' -> (\ t -> g \ t' -> x (t <> t')) (s <> s')) =
- \ s -> f (\ s' -> g \ t' -> x (s <> s' <> t'))
- RHS := \ s -> (f <<< extend g) (\ s' -> x (s <> s')) =
- \ s -> (\ y -> f (extend g y)) (\ s' -> x (s <> s')) =
- \ s -> (\ y -> f (\ t -> g (\ t' -> y (t <> t')))) (\ s' -> x (s <> s')) =
- \ s -> f (\ t -> g (\ t' -> (\ s' -> x (s <> s')) (t <> t'))) =
- \ s -> f (\ t -> g (\ t' -> x (s <> t <> t'))) = (via renaming)
- \ s -> f (\ s' -> g \ t' -> x (s <> s' <> t'))
(Monoid m) => Comonad (Traced m)
- Law: extract <<= xs = xs
- Proof:
- RHS := \ x -> s
- LHS := extend extract (\ x -> s) =
- \ t -> extract (\ t' -> (\ x -> s) (t <> t')) =
- \ t -> (\ x -> s) (t <> mempty) =
- \ t -> (\ x -> s) t =
- \ x -> s
#track Source
track :: forall m a. Monoid m => m -> Traced m a -> a
- Law: track mempty = extract
- Proof:
- First, rewrite as: track mempty f = extract f
- RHS := f mempty
- LHS := f mempty
- Law: (track s =<= track t) x = track (s <> t) x
- Proof:
- RHS := track (s <> t) x = x (s <> t)
- LHS := composeCoKliesliFlipped (track s) (track t) x =
- track s (track t <<= x) =
- track s (extend (track t) x) =
- track s (\ t' -> (track t) \ t'' -> x (t' <> t'')) =
- track s (\ t' -> x (t' <> t)) =
- x (s <> t)
- Modules
- Control.
Comonad. Transformerless. Env - Control.
Comonad. Transformerless. Store - Control.
Comonad. Transformerless. Traced - Control.
Monad. Transformerless. Cont - Control.
Monad. Transformerless. Except - Control.
Monad. Transformerless. RWS - Control.
Monad. Transformerless. Reader - Control.
Monad. Transformerless. State - Control.
Monad. Transformerless. Writer - Data.
Functor. Pairing. Transformerless