Skip to content

Instantly share code, notes, and snippets.

@ryan-haskell
Last active October 11, 2019 16:24
Show Gist options
  • Save ryan-haskell/588b31d4ad93f42da240ef1dc92e8d2f to your computer and use it in GitHub Desktop.
Save ryan-haskell/588b31d4ad93f42da240ef1dc92e8d2f to your computer and use it in GitHub Desktop.
Potential API tweak
module Application exposing (..., init, update, bundle, Initializer, Updater, Bundler)
type Initializer =
Initializer (Context -> ( Model, Cmd Msg, Cmd App.Msg))
type Updater =
Updater (Context -> ( Model, Cmd Msg, Cmd App.Msg))
type Bundler =
Bundler (Context -> Bundle Msg)
init : { page : Page } -> Initializer
update : { page : Page, model : Model, msg : Msg } -> Updater
view : { page : Page, model : Model } -> Bundler
module Pages exposing (init, update, bundle)
init : Route -> Initializer
update : Msg -> Model -> Updater
view : Model -> Context -> Bundler
-- CURRENT API --
module Application exposing (..., init, update, bundle)
init : { page : Page } -> Context -> ( Model, Cmd Msg, Cmd App.Msg)
update : { page : Page, model : Model, msg : Msg } -> Context -> ( Model, Cmd Msg, Cmd App.Msg)
view : { page : Page, model : Model } -> Context -> Bundle Msg
module Pages exposing (init, update, bundle)
init : Route -> Context -> ( Model, Cmd Msg, Cmd App.Msg)
update : Msg -> Model -> Context -> ( Model, Cmd Msg, Cmd App.Msg)
view : Model -> Context -> Bundle Msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment