Idris2Doc : Log4Types.Core.Action

Log4Types.Core.Action

(source)
The fundamental LogAction type and combinators.

A `LogAction m msg` is a first-class logging value: a function that
consumes a message of type `msg` in some monadic context `m`.
LogActions compose via Semigroup (fan-out to multiple destinations),
transform via Contravariant (adapt message types), and filter via
predicates.

Definitions

recordLogAction : (Type->Type) ->Type->Type
  A logging action that consumes messages of type `msg` in context `m`.

This is the central type of log4types. A LogAction is a first-class
value that can be composed, transformed, and passed around.

Totality: total
Visibility: public export
Constructor: 
MkLogAction : (msg->m ()) ->LogActionmmsg

Projection: 
.unLogAction : LogActionmmsg->msg->m ()

Hints:
Contravariant (LogActionm)
Applicativem=>Monoid (LogActionmmsg)
Applicativem=>Semigroup (LogActionmmsg)
.unLogAction : LogActionmmsg->msg->m ()
Totality: total
Visibility: public export
unLogAction : LogActionmmsg->msg->m ()
Totality: total
Visibility: public export
(<&) : LogActionmmsg->msg->m ()
  Execute a log action on a message.

```idris
logStringStdout <& "hello"
```

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 5
(&>) : msg->LogActionmmsg->m ()
  Execute a log action on a message (flipped).

Totality: total
Visibility: public export
Fixity Declaration: infixr operator, level 5
cmap : (a->b) ->LogActionmb->LogActionma
  Transform the message type before logging.

If you can log `b` and you have `a -> b`, you can log `a`.

Totality: total
Visibility: public export
cmapM : Monadm=> (a->mb) ->LogActionmb->LogActionma
  Transform the message type using a monadic computation.

Like `cmap` but the transformation can perform effects.
Useful for enriching messages with timestamps, thread IDs, etc.

Totality: total
Visibility: public export
cfilter : Applicativem=> (msg->Bool) ->LogActionmmsg->LogActionmmsg
  Only log messages satisfying a predicate.

Totality: total
Visibility: public export
cfilterM : Monadm=> (msg->mBool) ->LogActionmmsg->LogActionmmsg
  Only log messages satisfying a monadic predicate.

Totality: total
Visibility: public export
cmapMaybe : Applicativem=> (a->Maybeb) ->LogActionmb->LogActionma
  Transform and filter: only log when the function returns Just.

Totality: total
Visibility: public export
divide : Applicativem=> (a-> (b, c)) ->LogActionmb->LogActionmc->LogActionma
  Split a message into two parts and log each to a different action.

Contravariant analogue of Applicative: if you can split `a` into
`(b, c)` and log each independently, you can log `a`.

Totality: total
Visibility: public export
choose : Applicativem=> (a->Eitherbc) ->LogActionmb->LogActionmc->LogActionma
  Route a message to one of two loggers based on a decision function.

Contravariant analogue of Alternative: if you can decide whether
`a` is a `b` or a `c`, and log each, you can log `a`.

Totality: total
Visibility: public export
hoistLogAction : (mx->nx) ->LogActionma->LogActionna
  Transform the monadic context of a LogAction via a natural transformation.

Totality: total
Visibility: public export