Created
April 3, 2018 10:29
-
-
Save ufocoder/86eda999be45a9858ad70535de2edbc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (Html) | |
import Time exposing (Time, second) | |
main = | |
Html.program | |
{ init = init | |
, view = view | |
, update = update | |
, subscriptions = subscriptions | |
} | |
type alias Model = Time | |
init : (Model, Cmd Msg) | |
init = | |
(0, Cmd.none) | |
type Msg | |
= Tick Time | |
update : Msg -> Model -> (Model, Cmd Msg) | |
update msg model = | |
case msg of | |
Tick newTime -> | |
(newTime, Cmd.none) | |
subscriptions : Model -> Sub Msg | |
subscriptions model = | |
Time.every second Tick | |
view : Model -> Html Msg | |
view model = | |
Html.text (toString model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment