eventuo11y-0.9.0.1: An event-oriented observability library
CopyrightCopyright 2022 Shea Levy.
LicenseApache-2.0
Maintainershea@shealevy.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Observe.Event.Class

Description

Core typeclass for an mtl-style handling of EventBackends. See Observe.Event.Explicit for an explicit, function-based interface.

Synopsis

Documentation

class (forall r s. Monad (em r s), Monad (BackendMonad em)) => MonadEvent em where Source #

Monads suitable for Event-based instrumentation, with implicit EventBackend management.

See Observe.Event.Explicit for Event-based instrumentation with explicit EventBackend passing.

Note that em is an indexed monad of EventMonadKind.

Associated Types

type BackendMonad em :: Type -> Type Source #

The monad of the implicitly carried EventBackend

Methods

liftBackendMonad :: BackendMonad em a -> em r s a Source #

 

backend :: em r s (EnvBackend em r s) Source #

Access the implicitly carried EventBackend

withModifiedBackend Source #

Arguments

:: (EnvBackend em r s -> EnvBackend em r' s')

Modify the EventBackend

Note that the modification may change the reference and selector types.

-> em r' s' a

Action to run with the modified backend available.

-> em r s a 

Run an instrumented action with a modified EventBackend

Instances

Instances details
Monad m => MonadEvent (EventT m) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type BackendMonad (EventT m) :: Type -> Type Source #

Methods

liftBackendMonad :: forall a r (s :: SelectorKind). BackendMonad (EventT m) a -> EventT m r s a Source #

backend :: forall r (s :: SelectorKind). EventT m r s (EnvBackend (EventT m) r s) Source #

withModifiedBackend :: forall r (s :: SelectorKind) r' (s' :: SelectorKind) a. (EnvBackend (EventT m) r s -> EnvBackend (EventT m) r' s') -> EventT m r' s' a -> EventT m r s a Source #

(MonadEvent em, MonadTransControl t, forall r (s :: SelectorKind). Monad (t (em r s))) => MonadEvent (TransEventMonad t em) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type BackendMonad (TransEventMonad t em) :: Type -> Type Source #

Methods

liftBackendMonad :: forall a r (s :: SelectorKind). BackendMonad (TransEventMonad t em) a -> TransEventMonad t em r s a Source #

backend :: forall r (s :: SelectorKind). TransEventMonad t em r s (EnvBackend (TransEventMonad t em) r s) Source #

withModifiedBackend :: forall r (s :: SelectorKind) r' (s' :: SelectorKind) a. (EnvBackend (TransEventMonad t em) r s -> EnvBackend (TransEventMonad t em) r' s') -> TransEventMonad t em r' s' a -> TransEventMonad t em r s a Source #

type EnvBackend em = EventBackend (BackendMonad em) Source #

The type of the implicit EventBackend of a MonadEvent

newtype TransEventMonad t em r s a Source #

Apply a MonadTransformer to an EventMonadKind to get a transformed EventMonadKind

When t is MonadTransControl and em is MonadEvent, TransEventMonad t em is MonadEvent and has all of the relevant instances conferred by t.

Constructors

TransEventMonad 

Fields

Instances

Instances details
MonadBaseControl b (t (em r s)) => MonadBaseControl b (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type StM (TransEventMonad t em r s) a #

Methods

liftBaseWith :: (RunInBase (TransEventMonad t em r s) b -> b a) -> TransEventMonad t em r s a #

restoreM :: StM (TransEventMonad t em r s) a -> TransEventMonad t em r s a #

MonadError e (t (em r s)) => MonadError e (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

throwError :: e -> TransEventMonad t em r s a #

catchError :: TransEventMonad t em r s a -> (e -> TransEventMonad t em r s a) -> TransEventMonad t em r s a #

MonadReader r' (t (em r s)) => MonadReader r' (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

ask :: TransEventMonad t em r s r' #

local :: (r' -> r') -> TransEventMonad t em r s a -> TransEventMonad t em r s a #

reader :: (r' -> a) -> TransEventMonad t em r s a #

MonadState s' (t (em r s)) => MonadState s' (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

get :: TransEventMonad t em r s s' #

put :: s' -> TransEventMonad t em r s () #

state :: (s' -> (a, s')) -> TransEventMonad t em r s a #

MonadWriter w (t (em r s)) => MonadWriter w (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

writer :: (a, w) -> TransEventMonad t em r s a #

tell :: w -> TransEventMonad t em r s () #

listen :: TransEventMonad t em r s a -> TransEventMonad t em r s (a, w) #

pass :: TransEventMonad t em r s (a, w -> w) -> TransEventMonad t em r s a #

MonadBase b (t (em r s)) => MonadBase b (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

liftBase :: b α -> TransEventMonad t em r s α #

(MonadEvent em, MonadTransControl t, forall r (s :: SelectorKind). Monad (t (em r s))) => MonadEvent (TransEventMonad t em) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type BackendMonad (TransEventMonad t em) :: Type -> Type Source #

Methods

liftBackendMonad :: forall a r (s :: SelectorKind). BackendMonad (TransEventMonad t em) a -> TransEventMonad t em r s a Source #

backend :: forall r (s :: SelectorKind). TransEventMonad t em r s (EnvBackend (TransEventMonad t em) r s) Source #

withModifiedBackend :: forall r (s :: SelectorKind) r' (s' :: SelectorKind) a. (EnvBackend (TransEventMonad t em) r s -> EnvBackend (TransEventMonad t em) r' s') -> TransEventMonad t em r' s' a -> TransEventMonad t em r s a Source #

MonadFail (t (em r s)) => MonadFail (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

fail :: String -> TransEventMonad t em r s a #

MonadFix (t (em r s)) => MonadFix (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mfix :: (a -> TransEventMonad t em r s a) -> TransEventMonad t em r s a #

MonadIO (t (em r s)) => MonadIO (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

liftIO :: IO a -> TransEventMonad t em r s a #

MonadZip (t (em r s)) => MonadZip (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mzip :: TransEventMonad t em r s a -> TransEventMonad t em r s b -> TransEventMonad t em r s (a, b) #

mzipWith :: (a -> b -> c) -> TransEventMonad t em r s a -> TransEventMonad t em r s b -> TransEventMonad t em r s c #

munzip :: TransEventMonad t em r s (a, b) -> (TransEventMonad t em r s a, TransEventMonad t em r s b) #

Contravariant (t (em r s)) => Contravariant (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

contramap :: (a' -> a) -> TransEventMonad t em r s a -> TransEventMonad t em r s a' #

(>$) :: b -> TransEventMonad t em r s b -> TransEventMonad t em r s a #

Alternative (t (em r s)) => Alternative (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

empty :: TransEventMonad t em r s a #

(<|>) :: TransEventMonad t em r s a -> TransEventMonad t em r s a -> TransEventMonad t em r s a #

some :: TransEventMonad t em r s a -> TransEventMonad t em r s [a] #

many :: TransEventMonad t em r s a -> TransEventMonad t em r s [a] #

Applicative (t (em r s)) => Applicative (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

pure :: a -> TransEventMonad t em r s a #

(<*>) :: TransEventMonad t em r s (a -> b) -> TransEventMonad t em r s a -> TransEventMonad t em r s b #

liftA2 :: (a -> b -> c) -> TransEventMonad t em r s a -> TransEventMonad t em r s b -> TransEventMonad t em r s c #

(*>) :: TransEventMonad t em r s a -> TransEventMonad t em r s b -> TransEventMonad t em r s b #

(<*) :: TransEventMonad t em r s a -> TransEventMonad t em r s b -> TransEventMonad t em r s a #

Functor (t (em r s)) => Functor (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

fmap :: (a -> b) -> TransEventMonad t em r s a -> TransEventMonad t em r s b #

(<$) :: a -> TransEventMonad t em r s b -> TransEventMonad t em r s a #

Monad (t (em r s)) => Monad (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

(>>=) :: TransEventMonad t em r s a -> (a -> TransEventMonad t em r s b) -> TransEventMonad t em r s b #

(>>) :: TransEventMonad t em r s a -> TransEventMonad t em r s b -> TransEventMonad t em r s b #

return :: a -> TransEventMonad t em r s a #

MonadPlus (t (em r s)) => MonadPlus (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mzero :: TransEventMonad t em r s a #

mplus :: TransEventMonad t em r s a -> TransEventMonad t em r s a -> TransEventMonad t em r s a #

MonadCatch (t (em r s)) => MonadCatch (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

catch :: Exception e => TransEventMonad t em r s a -> (e -> TransEventMonad t em r s a) -> TransEventMonad t em r s a #

MonadMask (t (em r s)) => MonadMask (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mask :: ((forall a. TransEventMonad t em r s a -> TransEventMonad t em r s a) -> TransEventMonad t em r s b) -> TransEventMonad t em r s b #

uninterruptibleMask :: ((forall a. TransEventMonad t em r s a -> TransEventMonad t em r s a) -> TransEventMonad t em r s b) -> TransEventMonad t em r s b #

generalBracket :: TransEventMonad t em r s a -> (a -> ExitCase b -> TransEventMonad t em r s c) -> (a -> TransEventMonad t em r s b) -> TransEventMonad t em r s (b, c) #

MonadThrow (t (em r s)) => MonadThrow (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

throwM :: Exception e => e -> TransEventMonad t em r s a #

MonadAllocate (t (em r s)) => MonadAllocate (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type AllocationContext (TransEventMonad t em r s) :: Type -> Type #

type GeneralReleaseKey (TransEventMonad t em r s) #

type AllocationException (TransEventMonad t em r s) #

MonadWith (t (em r s)) => MonadWith (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type WithException (TransEventMonad t em r s) #

Methods

stateThreadingGeneralWith :: GeneralAllocate (TransEventMonad t em r s) (WithException (TransEventMonad t em r s)) releaseReturn b a -> (a -> TransEventMonad t em r s b) -> TransEventMonad t em r s (b, releaseReturn) #

MonadCont (t (em r s)) => MonadCont (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

callCC :: ((a -> TransEventMonad t em r s b) -> TransEventMonad t em r s a) -> TransEventMonad t em r s a #

PrimMonad (t (em r s)) => PrimMonad (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type PrimState (TransEventMonad t em r s) #

Methods

primitive :: (State# (PrimState (TransEventMonad t em r s)) -> (# State# (PrimState (TransEventMonad t em r s)), a #)) -> TransEventMonad t em r s a #

MonadUnliftIO (t (em r s)) => MonadUnliftIO (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

withRunInIO :: ((forall a. TransEventMonad t em r s a -> IO a) -> IO b) -> TransEventMonad t em r s b #

type BackendMonad (TransEventMonad t em) Source # 
Instance details

Defined in Observe.Event.Class

type AllocationContext (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

type AllocationContext (TransEventMonad t em r s) = AllocationContext (t (em r s))
type AllocationException (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

type GeneralReleaseKey (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

type GeneralReleaseKey (TransEventMonad t em r s) = GeneralReleaseKey (t (em r s))
type WithException (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

type WithException (TransEventMonad t em r s) = WithException (t (em r s))
type PrimState (TransEventMonad t em r s) Source # 
Instance details

Defined in Observe.Event.Class

type PrimState (TransEventMonad t em r s) = PrimState (t (em r s))
type StM (TransEventMonad t em r s) a Source # 
Instance details

Defined in Observe.Event.Class

type StM (TransEventMonad t em r s) a = StM (t (em r s)) a

EventT

newtype EventT m r s a Source #

Make a monad into a MonadEvent.

Constructors

EventT (ReaderT (EventBackend m r s) m a) 

Instances

Instances details
MonadBaseControl b m => MonadBaseControl b (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type StM (EventT m r s) a #

Methods

liftBaseWith :: (RunInBase (EventT m r s) b -> b a) -> EventT m r s a #

restoreM :: StM (EventT m r s) a -> EventT m r s a #

MonadError e m => MonadError e (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

throwError :: e -> EventT m r s a #

catchError :: EventT m r s a -> (e -> EventT m r s a) -> EventT m r s a #

MonadReader r m => MonadReader r (EventT m ref s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

ask :: EventT m ref s r #

local :: (r -> r) -> EventT m ref s a -> EventT m ref s a #

reader :: (r -> a) -> EventT m ref s a #

MonadState s' m => MonadState s' (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

get :: EventT m r s s' #

put :: s' -> EventT m r s () #

state :: (s' -> (a, s')) -> EventT m r s a #

MonadWriter w m => MonadWriter w (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

writer :: (a, w) -> EventT m r s a #

tell :: w -> EventT m r s () #

listen :: EventT m r s a -> EventT m r s (a, w) #

pass :: EventT m r s (a, w -> w) -> EventT m r s a #

MonadBase b m => MonadBase b (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

liftBase :: b α -> EventT m r s α #

Monad m => MonadEvent (EventT m) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type BackendMonad (EventT m) :: Type -> Type Source #

Methods

liftBackendMonad :: forall a r (s :: SelectorKind). BackendMonad (EventT m) a -> EventT m r s a Source #

backend :: forall r (s :: SelectorKind). EventT m r s (EnvBackend (EventT m) r s) Source #

withModifiedBackend :: forall r (s :: SelectorKind) r' (s' :: SelectorKind) a. (EnvBackend (EventT m) r s -> EnvBackend (EventT m) r' s') -> EventT m r' s' a -> EventT m r s a Source #

MonadFail m => MonadFail (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

fail :: String -> EventT m r s a #

MonadFix m => MonadFix (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mfix :: (a -> EventT m r s a) -> EventT m r s a #

MonadIO m => MonadIO (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

liftIO :: IO a -> EventT m r s a #

MonadZip m => MonadZip (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mzip :: EventT m r s a -> EventT m r s b -> EventT m r s (a, b) #

mzipWith :: (a -> b -> c) -> EventT m r s a -> EventT m r s b -> EventT m r s c #

munzip :: EventT m r s (a, b) -> (EventT m r s a, EventT m r s b) #

Contravariant m => Contravariant (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

contramap :: (a' -> a) -> EventT m r s a -> EventT m r s a' #

(>$) :: b -> EventT m r s b -> EventT m r s a #

Alternative m => Alternative (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

empty :: EventT m r s a #

(<|>) :: EventT m r s a -> EventT m r s a -> EventT m r s a #

some :: EventT m r s a -> EventT m r s [a] #

many :: EventT m r s a -> EventT m r s [a] #

Applicative m => Applicative (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

pure :: a -> EventT m r s a #

(<*>) :: EventT m r s (a -> b) -> EventT m r s a -> EventT m r s b #

liftA2 :: (a -> b -> c) -> EventT m r s a -> EventT m r s b -> EventT m r s c #

(*>) :: EventT m r s a -> EventT m r s b -> EventT m r s b #

(<*) :: EventT m r s a -> EventT m r s b -> EventT m r s a #

Functor m => Functor (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

fmap :: (a -> b) -> EventT m r s a -> EventT m r s b #

(<$) :: a -> EventT m r s b -> EventT m r s a #

Monad m => Monad (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

(>>=) :: EventT m r s a -> (a -> EventT m r s b) -> EventT m r s b #

(>>) :: EventT m r s a -> EventT m r s b -> EventT m r s b #

return :: a -> EventT m r s a #

MonadPlus m => MonadPlus (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mzero :: EventT m r s a #

mplus :: EventT m r s a -> EventT m r s a -> EventT m r s a #

MonadCatch m => MonadCatch (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

catch :: Exception e => EventT m r s a -> (e -> EventT m r s a) -> EventT m r s a #

MonadMask m => MonadMask (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

mask :: ((forall a. EventT m r s a -> EventT m r s a) -> EventT m r s b) -> EventT m r s b #

uninterruptibleMask :: ((forall a. EventT m r s a -> EventT m r s a) -> EventT m r s b) -> EventT m r s b #

generalBracket :: EventT m r s a -> (a -> ExitCase b -> EventT m r s c) -> (a -> EventT m r s b) -> EventT m r s (b, c) #

MonadThrow m => MonadThrow (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

throwM :: Exception e => e -> EventT m r s a #

MonadAllocate m => MonadAllocate (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type AllocationContext (EventT m r s) :: Type -> Type #

type GeneralReleaseKey (EventT m r s) #

type AllocationException (EventT m r s) #

MonadWith m => MonadWith (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type WithException (EventT m r s) #

Methods

stateThreadingGeneralWith :: GeneralAllocate (EventT m r s) (WithException (EventT m r s)) releaseReturn b a -> (a -> EventT m r s b) -> EventT m r s (b, releaseReturn) #

MonadCont m => MonadCont (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

callCC :: ((a -> EventT m r s b) -> EventT m r s a) -> EventT m r s a #

PrimMonad m => PrimMonad (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Associated Types

type PrimState (EventT m r s) #

Methods

primitive :: (State# (PrimState (EventT m r s)) -> (# State# (PrimState (EventT m r s)), a #)) -> EventT m r s a #

MonadUnliftIO m => MonadUnliftIO (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

Methods

withRunInIO :: ((forall a. EventT m r s a -> IO a) -> IO b) -> EventT m r s b #

type BackendMonad (EventT m) Source # 
Instance details

Defined in Observe.Event.Class

type BackendMonad (EventT m) = m
type AllocationContext (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

type AllocationException (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

type GeneralReleaseKey (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

type WithException (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

type PrimState (EventT m r s) Source # 
Instance details

Defined in Observe.Event.Class

type PrimState (EventT m r s) = PrimState (ReaderT (EventBackend m r s) m)
type StM (EventT m r s) a Source # 
Instance details

Defined in Observe.Event.Class

type StM (EventT m r s) a = StM (ReaderT (EventBackend m r s) m) a

runEventT :: Monad m => EventT m r s a -> EventBackend m r s -> m a Source #

Run an EventT with an initial EventBackend.

eventLift :: forall m r s. Applicative m => StatelessControlTransformation m (EventT m r s) Source #

Lift m into EventT m.

Kind aliases

type EventMonadKind = ReferenceKind -> SelectorKind -> FunctorKind Source #

The kind of indexed monads aware of Event instrumentation

See MonadEvent.

type ReferenceKind = Type Source #

The kind of Event references

type SelectorKind = Type -> Type Source #

The kind of Event selectors

type FunctorKind = Type -> Type Source #

The kind of Functors