contra-tracer-0.2.0.0: Arrow and contravariant tracers
Copyright(c) Alexander Vieth 2019
LicenseApache-2.0
Maintaineraovieth@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Tracer.Arrow

Description

 
Synopsis

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.

Constructors

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.

Instances

Instances details
Monad m => Arrow (TracerA m) Source # 
Instance details

Defined in Control.Tracer.Arrow

Methods

arr :: (b -> c) -> TracerA m b c #

first :: TracerA m b c -> TracerA m (b, d) (c, d) #

second :: TracerA m b c -> TracerA m (d, b) (d, c) #

(***) :: TracerA m b c -> TracerA m b' c' -> TracerA m (b, b') (c, c') #

(&&&) :: TracerA m b c -> TracerA m b c' -> TracerA m b (c, c') #

Monad m => ArrowChoice (TracerA m) Source # 
Instance details

Defined in Control.Tracer.Arrow

Methods

left :: TracerA m b c -> TracerA m (Either b d) (Either c d) #

right :: TracerA m b c -> TracerA m (Either d b) (Either d c) #

(+++) :: TracerA m b c -> TracerA m b' c' -> TracerA m (Either b b') (Either c c') #

(|||) :: TracerA m b d -> TracerA m c d -> TracerA m (Either b c) d #

Monad m => Category (TracerA m :: Type -> Type -> Type) Source # 
Instance details

Defined in Control.Tracer.Arrow

Methods

id :: forall (a :: k). TracerA m a a #

(.) :: forall (b :: k) (c :: k) (a :: k). TracerA m b c -> TracerA m a b -> TracerA m a c #

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.

nat :: (forall x. m x -> n x) -> TracerA m a b -> TracerA n a b Source #

Use a natural transformation to change the underlying monad.