EventReactionADT

io.github.positionpal.location.domain.EventReactionADT
opaque trait EventReactionADT

An abstract data type for effectful event reactions.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Type members

Types

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

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

Attributes

The type of the event triggering the reaction.

The type of the event triggering the reaction.

Attributes

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

type Outcome

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

Value members

Concrete 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.

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.

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.