Module

Redox.Free

Package
purescript-redox
Repository
coot/purescript-redox

#Interp Source

type Interp dsl state eff = Free dsl (state -> state) -> state -> Aff eff state

#_dispatch Source

_dispatch :: forall e eff dsl state. (Error -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) Unit) -> (state -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) Unit) -> Interp dsl state (redox :: RedoxStore (read :: ReadRedox | e) | eff) -> Store state -> Free dsl (state -> state) -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) (Canceler (redox :: RedoxStore (read :: ReadRedox | e) | eff))

#dispatch Source

dispatch :: forall e eff dsl state. (Error -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) Unit) -> Interp dsl state (redox :: RedoxStore (read :: ReadRedox | e) | eff) -> Store state -> Free dsl (state -> state) -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) (Canceler (redox :: RedoxStore (read :: ReadRedox | e) | eff))

Dispatch dsl commands that will be interpreted in Aff monad. You have to write your own DSL for the state changes and an interpreter for it. Check out purescript-dsl-example or see the tests. This is useful if you want to have a batch dispatch that dispatches all the commands at once when the interpreter finished running over the commands.

#dispatchP Source

dispatchP :: forall e eff dsl state. (Error -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) Unit) -> Interp dsl state (redox :: RedoxStore (read :: ReadRedox | e) | eff) -> Store state -> Free dsl (state -> state) -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) (Canceler (redox :: RedoxStore (read :: ReadRedox | e) | eff))

Dispatch function which does not handle store updates. That's useful if the interpreter is updating the store. You can use Redox.Utils.mkIncInterp to create such interpreter.