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. (Either Error 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) (Fiber (redox :: RedoxStore (read :: ReadRedox | e) | eff) Unit)

#dispatch Source

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

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 your DSL.

#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) (Fiber (redox :: RedoxStore (read :: ReadRedox | e) | eff) Unit)

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