Elmish.TimeMachine.History
- Package
- purescript-elmish-time-machine
- Repository
- mcordova47/purescript-elmish-time-machine
#History Source
newtype History msg sA zipper type that allows easy traversal through pairs of states and messages in an Elmish UI
#IndexedEvent Source
type IndexedEvent msg s = { index :: Int, message :: Message msg, state :: s }A record representing a given state, its corresponding message, along with its distance from the present (in "steps" where past events are negative integers and future events are positive)
#Message Source
data Message msgInitial states have no associated previous message, so it helps to have a type that wraps either an "initial state" message or the latest message which led to the current state
#formatMessage Source
formatMessage :: forall msg. Boolean -> Message msg -> StringFormats a message (using its JS representation)
E.g. SetFoo2 {"value0": 1}
#formatState Source
formatState :: forall a. a -> StringFormats a given state by JSON.stringifying it
#future Source
future :: forall msg s. History msg s -> Array (IndexedEvent msg s)Gets an array of the future state/message pairs, along with its index (or distance from the present), ordered chronologically
#latestMessage Source
latestMessage :: forall msg s. History msg s -> Message msgGets the latest message
#past Source
past :: forall msg s. History msg s -> Array (IndexedEvent msg s)Gets an array of the past state/message pairs, along with its index (or distance from the present), ordered chronologically
#presentState Source
presentState :: forall msg s. History msg s -> sGets the current state