Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export a type alias for the core set of Pux effects #20

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/Pux.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Pux
( App
, Update
, EffModel
, CoreEffects
, noEffects
, fromSimple
, start
Expand Down Expand Up @@ -36,7 +37,7 @@ import Signal.Channel (CHANNEL, channel, subscribe, send)
-- | ```
start :: forall state action eff.
Config state action eff ->
Eff (err :: EXCEPTION, channel :: CHANNEL | eff) (App state action)
Eff (CoreEffects eff) (App state action)
start config = do
actionChannel <- channel Nil
let actionSignal = subscribe actionChannel
Expand Down Expand Up @@ -75,6 +76,18 @@ type Config state action eff =
, inputs :: Array (Signal action)
}

-- | The set of effects every Pux app needs to allow through when using `start`.
-- | Extend this type with your own app's effects, for example:
-- |
-- | ```purescript
-- | type AppEffects eff = (console :: CONSOLE | eff)
-- |
-- | main :: State -> Eff (CoreEffects (AppEffects (dom :: DOM))) (App State Action)
-- | main state = do
-- | -- ...
-- | ```
type CoreEffects eff = (channel :: CHANNEL, err :: EXCEPTION | eff)

-- | An `App` consists of three signals:
-- |
-- | * `html` – A signal of `Html` representing the current view of your
Expand Down