Header menu logo TDesu.FSharp

StateMachine.Builder<'TState, 'TEvent, 'TEffect> Type

Declarative builder for constructing state machine definitions.

Constructors

Constructor Description

Builder()

Full Usage: Builder()

Returns: Builder<'TState, 'TEvent, 'TEffect>
Returns: Builder<'TState, 'TEvent, 'TEffect>

Instance members

Instance member Description

this.Build

Full Usage: this.Build

Returns: Definition<'TState, 'TEvent, 'TEffect>

Build the state machine definition. When StateTag or EventTag is not set.

Returns: Definition<'TState, 'TEvent, 'TEffect>

this.EventTag

Full Usage: this.EventTag

Parameters:
    f : 'TEvent -> int

Set the event tag extractor (discriminated union case index). Function that returns the tag for a given event.

f : 'TEvent -> int

this.On

Full Usage: this.On

Parameters:
    sTag : int - The state discriminator tag.
    eTag : int - The event discriminator tag.
    handler : 'TState -> 'TEvent -> Result<TransitionResult<'TState, 'TEffect>, string> - The transition handler function.

Add a transition handler for the given (stateTag, eventTag) pair. If the same pair is registered multiple times, only the last handler is kept.

sTag : int

The state discriminator tag.

eTag : int

The event discriminator tag.

handler : 'TState -> 'TEvent -> Result<TransitionResult<'TState, 'TEffect>, string>

The transition handler function.

this.Otherwise

Full Usage: this.Otherwise

Parameters:
    handler : 'TState -> 'TEvent -> string

Set the handler for transitions not in the map. Function that returns an error message for invalid transitions.

handler : 'TState -> 'TEvent -> string

this.StateTag

Full Usage: this.StateTag

Parameters:
    f : 'TState -> int

Set the state tag extractor (discriminated union case index). Function that returns the tag for a given state.

f : 'TState -> int

Type something to start searching.