FilterableOps

io.github.positionpal.location.domain.FilterableOps

A mixin enriching the EventReactionADT with operations for filtering the execution of reactions.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type

Members list

Extensions

Extensions

extension [F[_]](reaction: EventReaction[F])(using evidence$1: Monad[F])
def when(predicate: (Environment, Event) => Boolean): EventReaction[F]

Filters the execution of the reaction based on the provided predicate function, which determines whether the reaction should be executed or the provided default outcome should be returned instead.

Filters the execution of the reaction based on the provided predicate function, which determines whether the reaction should be executed or the provided default outcome should be returned instead.

Value parameters

predicate

a function that evaluates to true if the reaction should be executed

Attributes

Returns

a new EventReaction that only runs if the predicate condition is satisfied.