Copyright | (c) Alexander Vieth 2019 |
---|---|
License | Apache-2.0 |
Maintainer | aovieth@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data TracerA m a b where
- runTracerA :: Monad m => TracerA m a () -> Kleisli m a ()
- compute :: Applicative m => (a -> b) -> TracerA m a b
- emit :: Applicative m => (a -> m ()) -> TracerA m a ()
- effect :: (a -> m b) -> TracerA m a b
- squelch :: Applicative m => TracerA m a ()
- nat :: (forall x. m x -> n x) -> TracerA m a b -> TracerA n a b
Documentation
data TracerA 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 -> TracerA 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 -> TracerA m a b | No emitting. There may be side-effects, but they are assumed to be
benign and will be discarded by |
runTracerA :: Monad m => TracerA 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) -> TracerA m a b Source #
Pure computation in a tracer: no side effects or emits.
emit :: Applicative m => (a -> m ()) -> TracerA m a () Source #
Do an emitting effect. Contrast with effect
which does not make the
tracer an emitting tracer.
effect :: (a -> m b) -> TracerA 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 => TracerA m a () Source #
Ignore the input and do not emit. The name is intended to lead to clear and suggestive arrow expressions.