Copyright | (c) Alexander Vieth 2019 |
---|---|
License | Apache-2.0 |
Maintainer | aovieth@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data Tracer m a b where
- runTracer :: Monad m => Tracer m a () -> Kleisli m a ()
- compute :: Applicative m => (a -> b) -> Tracer m a b
- emit :: Applicative m => (a -> m ()) -> Tracer m a ()
- effect :: (a -> m b) -> Tracer m a b
- squelch :: Applicative m => Tracer m a ()
- nat :: (forall x. m x -> n x) -> Tracer m a b -> Tracer n a b
Documentation
data Tracer m a b where Source #
Formal representation of a tracer arrow as a Kleisli arrow over some monad, but tagged so that we know whether it has any effects which will emit a trace.
Emitting :: Kleisli m a x -> Kleisli m x b -> Tracer m a b | An emitting part, followed by a non-emitting part. The non-emitting part is there so that later emitting parts can be tacked-on later. |
Squelching :: Kleisli m a b -> Tracer m a b | No emitting. There may be side-effects, but they are assumed to be
benign and will be discarded by |
runTracer :: Monad m => Tracer m a () -> Kleisli m a () Source #
The resulting Kleisli arrow includes all of the effects required to do the emitting part.
compute :: Applicative m => (a -> b) -> Tracer m a b Source #
Pure computation in a tracer: no side effects or emits.
emit :: Applicative m => (a -> m ()) -> Tracer m a () Source #
Do an emitting effect. Contrast with effect
which does not make the
tracer an emitting tracer.
effect :: (a -> m b) -> Tracer m a b Source #
Do a non-emitting effect. This effect will only be run if some part of
the tracer downstream emits (see emit
).
squelch :: Applicative m => Tracer m a () Source #
Ignore the input and do not emit. The name is intended to lead to clear and suggestive arrow expressions.