Module
Pux.Redux
- Package
- purescript-pux-redux
- Repository
- lightandlight/purescript-pux-redux
#Dispatch Source
type Dispatch r fx = Action r -> Eff (CoreEffects (redux :: REDUX | fx)) Unit
The type of redux's dispatch function
A dispatch function takes an action as an argument and returns an effectul computation that modifies the redux store, and has some other unknown effects.
foldp
:: forall fx ev st
. Dispatch (value :: Int) fx
-> FoldP st ev (redux :: REDUX | fx)
foldp dispatch ev st =
case ev of
... ->
{ state: ...
, effects:
[ ...
, liftEff (dispatch $ increment 5) $> Nothing
]
}
#initialDispatch Source
initialDispatch :: forall fx r. Dispatch r fx
A safe initial value for the dispatch function. This will normally be used from Javascript.
#appEvent Source
appEvent :: (forall ev. (DOMEvent -> ev) -> EventHandlers (DOMEvent -> ev)) -> (forall fx pl event. (DOMEvent -> event) -> EventHandlers (DOMEvent -> AppEvent pl fx event))
Lift an event source from supplying event
s to supplying AppEvent pl fx event
s
textInput :: forall ev pl fx. (String -> ev) -> HTML (AppEvent pl fx ev)
textInput event =
! type' "text"
#! appEvent onChange (event <<< targetValue)
#AppConfig Source
type AppConfig props pl fx ev = { dispatch :: Signal (Dispatch pl fx), foldp :: Dispatch pl fx -> FoldP (Record props) ev (redux :: REDUX | fx), initialState :: Record props, inputs :: Array (Signal ev), view :: Record props -> HTML (AppEvent pl fx ev) }
The configuration of a pux app that can interact with a redux store.
Use 'fromAppConfig' to obtain a regular 'Config'
#fromAppConfig Source
fromAppConfig :: forall props ev fx pl. AppConfig props pl fx ev -> Config (DOMEvent -> AppEvent pl fx ev) (AppEvent pl fx ev) (AppState pl props fx) (redux :: REDUX | fx)
Convert an 'AppConfig' to a 'Config'
main = do
app <- start $ fromAppConfig
{ initialState
, foldp
, view
, dispatch
, inputs: []
}
...
- Modules
- Pux.
Redux