Decision

sealed trait Decision[+R, +E, +A] extends Product with Serializable

Represents programs that decide in an event driven context

This is basically a simple state machine like the following:

[*] -> InDecisive
InDecisive -- event --> Accepted
InDecisive -- join --> InDecisive
InDecisive -- rejection --> Rejected (resets and terminates)
Accepted -- event --> Accepted (accumulates)
Accepted -- rejection --> Rejected (resets and terminates)

It forms a monad error and also is traversable.

Type parameters:
A

program output type

E

event type

R

rejection type

Companion:
object
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
class Accepted[E, T]
class InDecisive[T]
class Rejected[R]
Decision[R, E, A]

Value members

Concrete methods

inline def >>[R2 >: R, E2 >: E, B](f: => Decision[R2, E2, B]): Decision[R2, E2, B]
inline def >>=[R2 >: R, E2 >: E, B](f: A => Decision[R2, E2, B]): Decision[R2, E2, B]
def flatMap[R2 >: R, E2 >: E, B](f: A => Decision[R2, E2, B]): Decision[R2, E2, B]

binds another decision to this one, creates a new decision

binds another decision to this one, creates a new decision

whether is accepted or not

whether is accepted or not

whether is rejected or not

whether is rejected or not

def map[B](f: A => B): Decision[R, E, B]

creates a new decision that changes the output value of this one

creates a new decision that changes the output value of this one

def toEither: EitherNec[R, A]

Ignores events and creates an Either

Ignores events and creates an Either

Ignores events and errors and creates an Option that contains program output

Ignores events and errors and creates an Option that contains program output

Ignores events and creates a ValidatedNec

Ignores events and creates a ValidatedNec

def validate[R2 >: R, B](f: A => ValidatedNec[R2, B]): Decision[R2, E, B]

Validates output using a ValidatedNec

Validates output using a ValidatedNec

@targetName("validateEitherNec")
def validate[R2 >: R, B](f: A => EitherNec[R2, B]): Decision[R2, E, B]

Validates output using an EitherNec

Validates output using an EitherNec

@targetName("validateEither")
def validate[R2 >: R, B](f: A => Either[R2, B]): Decision[R2, E, B]

Validates output using an Either

Validates output using an Either

def visit[B](fr: Type[R] => B, fa: A => B): B

traverses this decision, run fr if there are errors and runs fa if there is some output

traverses this decision, run fr if there are errors and runs fa if there is some output

def void: Decision[R, E, Unit]

Ignores output value

Ignores output value

Inherited methods

def canEqual(that: Any): Boolean
Inherited from:
Equals
Inherited from:
Product
def productElement(n: Int): Any
Inherited from:
Product
Inherited from:
Product
Inherited from:
Product
Inherited from:
Product