Module

Radox.Internal.Types

Package
purescript-radox
Repository
danieljharvey/purescript-radox

#RadoxEffects Source

type RadoxEffects combinedActionType stateType = { dispatch :: combinedActionType -> Effect Unit, getState :: Effect stateType, state :: stateType }

#ReducerReturn Source

data ReducerReturn stateType

Type of return value from reducer

Constructors

#EffectfulReducer Source

type EffectfulReducer actionType stateType combinedActionType = RadoxEffects combinedActionType stateType -> actionType -> stateType -> ReducerReturn stateType

Type for any user-created Reducer function that takes an Action for a specific reducer, the entire state, and returns a new copy of the state

#Reducer Source

type Reducer actionType stateType = actionType -> stateType -> stateType

Type for a reducer that does need to trigger any side effects

#CombinedReducer Source

type CombinedReducer combinedActionType stateType = RadoxEffects combinedActionType stateType -> stateType -> combinedActionType -> ReducerReturn stateType

Type for the user-created Combined Reducer function, that takes a Variant of any action, and pipes it to the correct Reducer function, then returns the new state

#Listeners Source

type Listeners stateType = Array (stateType -> Effect Unit)

A Listener is a function that takes the new state and returns Effect Unit (so that it can use it to do something interesting, hopefully)

#Dispatcher Source

type Dispatcher combinedActionType = combinedActionType -> Effect Unit

A Dispatcher is the function that allows different parts of our app to send actions to the reducers and make Things Happen.

#RadoxStore Source

type RadoxStore combinedActionType stateType = { dispatch :: Dispatcher combinedActionType, getState :: Effect stateType, state :: stateType }

Type of store shared around so that the state can be accessed without needing Effect

#HasLabel Source

class HasLabel a (p :: Symbol) | a -> p

Typeclass that links any given Action sum type to the label it holds in the Combined Reducer / variant