Effect
An effect is a struct which abstracts a collection of interactions with sagas.
Use Effect
You can use effects in a Automaton or a handle block. You can create a handle block like this:
use Effectful # to use handle/1
handle fn ->
perform some_effect
endPre-defined Effects
Cizen has several pre-defined effects. For convenience, you can alias all of them by;
use Cizen.Effects # aliases all effects.or only specified effects:
use Cizen.Effects, only: [Subscribe, Receive, Dispatch]Effects for Event
Cizen.Effects.Subscribesubscribes events by the given filter.Cizen.Effects.Receivereceives an event which fulfills the given filter.Cizen.Effects.Dispatchdispatches an event with the given body.
Effects for Saga
Cizen.Effects.Startstarts a saga by the given saga struct.Cizen.Effects.Endends a saga by its saga ID.Cizen.Effects.Forkforks a saga.Cizen.Effects.Monitorstarts monitoring a saga.
Effects Combinators
Cizen.Effects.Allperforms all given effects.Cizen.Effects.Chainchains the given effects and performs them sequentially.Cizen.Effects.Mapmaps the result of the given effect.Cizen.Effects.Racestarts a race between the given effects.
Custom Effects
See Cizen.Effect.