| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.BM.Tracer
Synopsis
- newtype Tracer (m :: Type -> Type) a = Tracer {
- runTracer :: a -> m ()
- bracketObserve :: forall m s e b d. Monad m => (m s, m e, Tracer m (Observable s e d)) -> m b -> m b
- example :: IO Int
- exampleWithChoose :: IO Int
Documentation
newtype Tracer (m :: Type -> Type) a Source #
example: simply output a message on the console
let logTrace = traceWith $ showTracing $ stdoutTracer in logTrace "hello world"
example: calling a function and passing in a Tracer
example1 :: IO ()
example1 = do
let logTrace a = traceWith (showTracing (contramap ("Debug: " ++) stdoutTracer)) a
void $ callFun1 logTracecallFun1 :: (String -> IO ()) -> IO Int
callFun1 logTrace = do
logTrace "in function 1"
return 42Instances
| Contravariant (Tracer m) | |
| Applicative m => Divisible (Tracer m) Source # | |
| Applicative m => Decidable (Tracer m) Source # | |
| Applicative m => Semigroup (Tracer m s) | |
| Applicative m => Monoid (Tracer m s) | |
observing
bracketObserve :: forall m s e b d. Monad m => (m s, m e, Tracer m (Observable s e d)) -> m b -> m b Source #
examples
Orphan instances
| Applicative m => Divisible (Tracer m) Source # | |
| Applicative m => Decidable (Tracer m) Source # | |