diff --git a/examples/basic/package/Application/Internals/Sandbox/Page.elm b/examples/basic/package/Application/Internals/Sandbox/Page.elm index a8cf5ea..a937dc6 100644 --- a/examples/basic/package/Application/Internals/Sandbox/Page.elm +++ b/examples/basic/package/Application/Internals/Sandbox/Page.elm @@ -27,15 +27,10 @@ type Page pageModel pageMsg model msg type alias Page_ pageModel pageMsg model msg = { toModel : pageModel -> model , toMsg : pageMsg -> msg - , page : Config pageModel pageMsg model msg + , page : Sandbox pageModel pageMsg } -type Config pageModel pageMsg model msg - = StaticConfig Static - | SandboxConfig (Sandbox pageModel pageMsg) - - unwrap : Page pageModel pageMsg model msg -> Page_ pageModel pageMsg model msg @@ -53,16 +48,21 @@ type alias Static = static : - { toModel : () -> model - , toMsg : Never -> msg - , page : Static - } + Static + -> + { toModel : () -> model + , toMsg : Never -> msg + } -> Page () Never model msg -static page = +static page { toModel, toMsg } = Page - { toModel = page.toModel - , toMsg = page.toMsg - , page = StaticConfig page.page + { toModel = toModel + , toMsg = toMsg + , page = + { init = () + , update = always identity + , view = \_ -> Html.map never page.view + } } @@ -78,14 +78,15 @@ type alias Sandbox pageModel pageMsg = sandbox : - { toModel : pageModel -> model - , toMsg : pageMsg -> msg - , page : Sandbox pageModel pageMsg - } - -> Page pageModel pageMsg model msg -sandbox page = - Page - { toModel = page.toModel - , toMsg = page.toMsg - , page = SandboxConfig page.page + Sandbox pageModel pageMsg + -> + { toModel : pageModel -> model + , toMsg : pageMsg -> msg + } + -> Page pageModel pageMsg model msg +sandbox page { toModel, toMsg } = + Page + { toModel = toModel + , toMsg = toMsg + , page = page } diff --git a/examples/basic/package/Application/Sandbox.elm b/examples/basic/package/Application/Sandbox.elm index ff0425c..0f6829b 100644 --- a/examples/basic/package/Application/Sandbox.elm +++ b/examples/basic/package/Application/Sandbox.elm @@ -130,20 +130,22 @@ type alias Sandbox pageModel pageMsg = static : - { toModel : () -> model - , toMsg : Never -> msg - , page : Static - } + Static + -> + { toModel : () -> model + , toMsg : Never -> msg + } -> Page () Never model msg static = Page.static sandbox : - { toModel : pageModel -> model - , toMsg : pageMsg -> msg - , page : Sandbox pageModel pageMsg - } + Sandbox pageModel pageMsg + -> + { toModel : pageModel -> model + , toMsg : pageMsg -> msg + } -> Page pageModel pageMsg model msg sandbox = Page.sandbox diff --git a/examples/basic/src/Sandbox/Main.elm b/examples/basic/src/Sandbox/Main.elm index 50f2bcc..5b5e4f2 100644 --- a/examples/basic/src/Sandbox/Main.elm +++ b/examples/basic/src/Sandbox/Main.elm @@ -50,22 +50,19 @@ type alias Pages = pages : Pages pages = { homepage = - Application.static + Homepage.page { toModel = HomepageModel , toMsg = HomepageMsg - , page = Homepage.page } , counter = - Application.sandbox + Counter.page { toModel = CounterModel , toMsg = CounterMsg - , page = Counter.page } , notFound = - Application.static + NotFound.page { toModel = NotFoundModel , toMsg = NotFoundMsg - , page = NotFound.page } } diff --git a/examples/basic/src/Sandbox/Pages/Counter.elm b/examples/basic/src/Sandbox/Pages/Counter.elm index ce9b29d..6aed03b 100644 --- a/examples/basic/src/Sandbox/Pages/Counter.elm +++ b/examples/basic/src/Sandbox/Pages/Counter.elm @@ -15,12 +15,12 @@ type Msg | Decrement -page : Application.Sandbox Model Msg page = - { init = init - , update = update - , view = view - } + Application.sandbox + { init = init + , update = update + , view = view + } init : Model diff --git a/examples/basic/src/Sandbox/Pages/Homepage.elm b/examples/basic/src/Sandbox/Pages/Homepage.elm index 9625cc6..769cb0c 100644 --- a/examples/basic/src/Sandbox/Pages/Homepage.elm +++ b/examples/basic/src/Sandbox/Pages/Homepage.elm @@ -12,10 +12,10 @@ type alias Msg = Never -page : Application.Static page = - { view = view - } + Application.static + { view = view + } view : Html Msg diff --git a/examples/basic/src/Sandbox/Pages/NotFound.elm b/examples/basic/src/Sandbox/Pages/NotFound.elm index 5d0f62e..0fe6a1b 100644 --- a/examples/basic/src/Sandbox/Pages/NotFound.elm +++ b/examples/basic/src/Sandbox/Pages/NotFound.elm @@ -12,10 +12,10 @@ type alias Msg = Never -page : Application.Static page = - { view = view - } + Application.static + { view = view + } view : Html Msg