FilterableReaction

io.github.positionpal.reaction.ReactionADT.FilterableReaction
trait FilterableReaction[E, S, R] extends ReactionADT[E, S, R]

A set of operations that filter the Reaction execution

Attributes

Graph
Supertypes
trait ReactionADT[E, S, R]
class Object
trait Matchable
class Any
Known subtypes
trait OptionReaction[E, S, T]

Members list

Type members

Inherited and Abstract types

opaque type Reaction[F[_]]

Represent the reaction that's triggered within a specific Context

Represent the reaction that's triggered within a specific Context

Type parameters

F

The effect to apply

Attributes

Inherited from:
ReactionADT

Represent the result of the reaction

Represent the result of the reaction

Attributes

Inherited from:
ReactionADT

Value members

Inherited methods

def on[F[_]](reaction: Context[E, S] => F[R]): Reaction[F]

Create a reaction on an given Context

Create a reaction on an given Context

Value parameters

reaction

The function representing the reaction.

Attributes

Returns

The Reaction object.

Inherited from:
ReactionADT

Extensions

Extensions

extension [F[_]](reaction: Reaction[F])(using evidence$1: Monad[F])
def filter: Reaction[F]

Execute reaction only if a condition on the Context is met.

Execute reaction only if a condition on the Context is met.

Value parameters

predicate

A function that takes the Context and returns true if the reaction should be executed.

Attributes

Returns

A new Reaction that only runs if the predicate is satisfied.

def orElse(other: Reaction[F]): Reaction[F]

Execute the Reaction if a condition on the Context is met otherwise other will be executed.

Execute the Reaction if a condition on the Context is met otherwise other will be executed.

Value parameters

other

The reaction to execute if the predicate return false

predicate

The predicate that's executed on the context

Attributes

Returns

A new Reaction to reaction if the predicate returns true or other otherwise

Inherited extensions

extension [F[_]](reaction: Reaction[F])(using evidence$1: Monad[F])
def apply: F[R]

Executes the Reaction producing a ReactionResult

Executes the Reaction producing a ReactionResult

Value parameters

context

The Context in which the Reaction should run

Attributes

Returns

a functional structure F in which the result is contained

Inherited from:
ReactionADT