BinaryShortCircuitReaction

io.github.positionpal.location.domain.BinaryShortCircuitReaction

A trait representing an event reaction that produces two possible outcomes: a "left" (failure) and a "right" (success) outcome, following a short-circuit evaluation strategy: once the left outcome is produced, no further reactions are processed, stopping the chain of reactions at the first failure.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Type members

Types

The type of the left outcome, representing a failure.

The type of the left outcome, representing a failure.

Attributes

override type Outcome = Either[LeftOutcome, RightOutcome]

The outcome of the reaction application, i.e., the result of the reaction.

The outcome of the reaction application, i.e., the result of the reaction.

Attributes

The type of the right outcome, representing a success.

The type of the right outcome, representing a success.

Attributes

Inherited and Abstract types

The type of the reaction's environment, i.e., its context.

The type of the reaction's environment, i.e., its context.

Attributes

Inherited from:
EventReactionADT

The type of the event triggering the reaction.

The type of the event triggering the reaction.

Attributes

Inherited from:
EventReactionADT
opaque type EventReaction[F[_]]

A computational reaction to an Event within a given Environment, abstracted over an effect F (e.g., IO, Task, etc.).

A computational reaction to an Event within a given Environment, abstracted over an effect F (e.g., IO, Task, etc.).

Attributes

Inherited from:
EventReactionADT

Value members

Inherited methods

def on[F[_]](reaction: ((Environment, Event)) => F[Outcome]): EventReaction[F]

Creates an EventReaction from the provided effectful reaction function.

Creates an EventReaction from the provided effectful reaction function.

Type parameters

F

the effect type of the reaction.

Attributes

Returns

the created EventReaction.

Inherited from:
EventReactionADT

Extensions

Extensions

extension [F[_]](reaction: EventReaction[F])(using evidence$1: Monad[F])
def >>>: EventReaction[F]

Composes two EventReactions by chaining their execution, running this reaction first, followed by the provided other reaction, within the effectful context F.

Composes two EventReactions by chaining their execution, running this reaction first, followed by the provided other reaction, within the effectful context F.

Value parameters

other

the EventReaction to execute after this one

Attributes

Returns

a new EventReaction with the combined behavior of the two reactions.

Inherited extensions

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

Executes the event reaction by applying the provided environment and event, resulting in an Outcome wrapped in the effect type F[_]. The computation is deferred and executed within the effect context.

Executes the event reaction by applying the provided environment and event, resulting in an Outcome wrapped in the effect type F[_]. The computation is deferred and executed within the effect context.

Value parameters

environment

the Environment (context) in which the event reaction computation occurs

event

the Event triggering the reaction

Attributes

Returns

an effect F containing the resulting Outcome of processing the event.

Inherited from:
EventReactionADT