-
Value hold in this Moore machine.
Declaration
Swift
public let view: V -
Function to handle inputs to the Moore machine.
Declaration
Swift
public let handle: (E) -> Moore<E, V> -
Safe downcast.
Declaration
Swift
public static func fix(_ value: MooreOf<E, V>) -> Moore<E, V>Parameters
valueValue in the higher-kind form.
Return Value
Value cast to Moore.
-
Creates a Moore machine from a hidden initial state and a function that provides the next value and handling function.
Declaration
Swift
public static func unfold<S>( _ state: S, _ next: @escaping (S) -> (V, (E) -> S)) -> Moore<E, V>Parameters
stateInitial state.
nextFunction to determine the next value and handling function.
Return Value
A Moore machine described from the input values.
-
Creates a Moore machine from an initial state, a rendering function and an update function.
Declaration
Swift
public static func from<S>( initialState: S, render: @escaping (S) -> V, update: @escaping (S, E) -> S) -> Moore<E, V>Parameters
initialStateInitial state.
renderRendering function.
updateUpdate function.
Return Value
A Moore machine described from the input functions.
-
Creates a Moore machine from an initial state, a rendering function and an update function.
Declaration
Swift
public static func from<S>( initialState: S, render: @escaping (S) -> V, update: @escaping (E) -> State<S, S>) -> Moore<E, V>Parameters
initialStateInitial state.
renderRendering function.
updateUpdate function.
Return Value
A Moore machine described from the input functions.
-
Initializes a Moore machine.
Declaration
Swift
public init(view: V, handle: @escaping (E) -> Moore<E, V>)Parameters
viewValue wrapped in the machine.
handleFunction to handle inputs to the machine.
-
Transforms the inputs this machine is able to handle.
Declaration
Swift
public func contramapInput<EE>(_ f: @escaping (EE) -> E) -> Moore<EE, V>Parameters
fTransforming funtion.
Return Value
A Moore machine that works on the new type of inputs.
-
Creates a Moore machine that logs the inputs it receives.
Declaration
Swift
static var log: Moore<E, E> { get }
Install in Dash
Moore Class Reference