in-other-words-0.1.0.0: A higher-order effect system where the sky's the limit

Safe HaskellNone
LanguageHaskell2010

Control.Effect.Trace

Contents

Synopsis

Effects

data Trace m a where Source #

An effect for debugging by printing/logging strings.

Constructors

Trace :: String -> Trace m () 

Actions

trace :: Eff Trace m => String -> m () Source #

Log the provided string

traceShow :: (Show a, Eff Trace m) => a -> m () Source #

show the provided item and log it.

Interpretations

runTraceList :: forall m a p. (Threaders '[WriterThreads] m p, Carrier m) => TraceListC m a -> m ([String], a) Source #

Run a Trace effect purely by accumulating all traced strings into a list.

runTraceListIO :: Eff (Embed IO) m => InterpretReifiedC Trace m a -> m ([String], a) Source #

Run a Trace effect by accumulating all traced strings into a list using atomic operations in IO.

This has a higher-rank type, as it makes use of InterpretReifiedC. This makes runTraceListIO very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower runTraceListIOSimple, which doesn't have a higher-rank type.

runTracePrinting :: Eff (Embed IO) m => TracePrintingC m a -> m a Source #

Run a Trace effect by printing each traced string to stderr.

runTraceToHandle :: Eff (Embed IO) m => Handle -> InterpretReifiedC Trace m a -> m a Source #

Run Trace effect by providing each traced string to the provided Handle.

This has a higher-rank type, as it makes use of InterpretReifiedC. This makes runTraceToHandle very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower runTraceToHandleSimple, which doesn't have a higher-rank type.

ignoreTrace :: Carrier m => IgnoreTraceC m a -> m a Source #

Run a Trace effect by ignoring it, doing no logging at all.

traceIntoTell :: HeadEff (Tell String) m => TraceIntoTellC m a -> m a Source #

Rewrite a Trace effect into a Tell String effect on top of the effect stack.

Simple variants of interprations

runTraceListIOSimple :: forall m a p. (Eff (Embed IO) m, Threaders '[ReaderThreads] m p) => InterpretSimpleC Trace m a -> m ([String], a) Source #

Run a Trace effect by accumulating all traced strings into a list using atomic operations in IO.

This is a less performant version of runTraceListIOSimple that doesn't have a higher-rank type, making it much easier to use partially applied.

runTraceToHandleSimple :: forall m a p. (Eff (Embed IO) m, Threaders '[ReaderThreads] m p) => Handle -> InterpretSimpleC Trace m a -> m a Source #

Run Trace effect by providing each traced string to the provided Handle.

This is a less performant version of runTraceToHandle that doesn't have a higher-rank type, making it much easier to use partially applied.

Threading constraints

class (forall s. Monoid s => Threads (WriterT s) p) => WriterThreads p Source #

WriterThreads accepts the following primitive effects:

Instances
(forall s. Monoid s => Threads (WriterT s) p) => WriterThreads p Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Carriers

type TracePrintingC = InterpretC TracePrintingH Trace Source #

type IgnoreTraceC = InterpretC IgnoreTraceH Trace Source #