From 8e3a7bf1cb83bbb6e3dcd54308eefa52a29cd679 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 3 Jun 2016 20:27:16 +0200 Subject: Migrate to elm 0.17 --- src/client/elm/Main.elm | 79 +++++++++++-------------------------------------- 1 file changed, 17 insertions(+), 62 deletions(-) (limited to 'src/client/elm/Main.elm') diff --git a/src/client/elm/Main.elm b/src/client/elm/Main.elm index 0813573..d15813d 100644 --- a/src/client/elm/Main.elm +++ b/src/client/elm/Main.elm @@ -1,66 +1,21 @@ -module Main +module Main exposing ( main - ) where + ) -import Graphics.Element exposing (..) -import Json.Decode as Json +import Navigation +import Time +import Msg -import Html exposing (Html) -import StartApp exposing (App) -import Effects exposing (Effects, Never) -import TransitRouter - -import Task exposing (..) -import Time exposing (..) - -import Server -import Mailbox -import Action exposing (..) -import Model exposing (Model, initialModel) -import Model.InitResult as InitResult exposing (initResultDecoder) -import Update exposing (update, routerConfig) +import Model exposing (init) +import Update exposing (update, urlUpdate) import View exposing (view) - -import Utils.Maybe exposing (isJust) -import Utils.Effects as Effects - -main : Signal Html -main = app.html - -app : App Model -app = StartApp.start - { init = (initData, Effects.none) `Effects.andThen` initRouter - , view = view - , update = update - , inputs = - [ Signal.map UpdateTime (Time.every 1000) - , Signal.map RouterAction TransitRouter.actions - , Mailbox.signal - ] - } - --- Init - -initData : Model -initData = - case Json.decodeString initResultDecoder initResult of - Ok init -> - initialModel initialTime translations conf init - Err _ -> - initialModel initialTime translations conf InitResult.InitEmpty - -initRouter : Model -> (Model, Effects Action) -initRouter model = TransitRouter.init routerConfig location model - --- Output ports - -port tasks : Signal (Task.Task Never ()) -port tasks = app.tasks - --- Input ports - -port initialTime : Time -port translations : String -port conf : String -port initResult : String -port location : String +import Page + +main = + Navigation.programWithFlags (Navigation.makeParser Page.fromHash) + { init = init + , view = view + , update = update + , urlUpdate = urlUpdate + , subscriptions = \_ -> Time.every 1000 Msg.UpdateTime + } -- cgit v1.2.3