Jidoka.Turn.Transition (Jidoka v0.8.0-beta.1)

Copy Markdown View Source

Pure transition result for turn state changes.

Domain functions can produce state plus neutral events/diagnostics. commit/1 appends those events to the state in sequence order.

Summary

Types

state()

@type state() :: map()

t()

@type t() :: %Jidoka.Turn.Transition{
  diagnostics: [any()],
  events: [term()],
  state: any()
}

Functions

commit(transition)

@spec commit(t()) :: state()

diagnostic(transition, diagnostic)

@spec diagnostic(t(), term()) :: t()

event(transition, event, attrs \\ [])

@spec event(t(), atom(), keyword() | map()) :: t()

new(state, attrs \\ [])

@spec new(state(), keyword() | map()) :: {:ok, t()} | {:error, term()}

new!(state, attrs \\ [])

@spec new!(state(), keyword() | map()) :: t()

schema()

@spec schema() :: Zoi.schema()