xilnocas/step/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Renamed to nicklawls/step. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as xilnocas/step still install under that name. 11 versions of 15 come from the new location (see their notes).

Step

Some stuff

type Step state msg output

Step

a Step state msg output describes one step of a state machine.

On each step, the state machine can either

  • noop, staying in the same state and executing no commands
  • step to some new state, potentially executing msg-returning commands
  • exit, and return a value of type output
map : (a -> b) -> Step a msg output -> Step b msg output
noop : Step state msg output
Step state msg output
-> Step state msg output
-> Step state msg output
run : Step state msg Never -> Maybe ( state, Cmd msg )
to : state -> Step state msg output

step to a state with no commands

withCmd : Cmd msg -> Step state msg output -> Step state msg output
mapMsg : (a -> b) -> Step state a output -> Step state b output
exit : output -> Step state msg output
mapExit : (o -> p) -> Step state msg o -> Step state msg p
onExit : (o -> Step state msg p) -> Step state msg o -> Step state msg p
(msg -> model -> Step model msg Never)
-> msg
-> model
-> ( model, Cmd msg )

asUpdateFunction

a little helper function for the common case: turn an update function that returns a Step to a normal elm architecture update function uses run internally to default with the provided model in case of a noop