Skip to content

Instantly share code, notes, and snippets.

@ufocoder
Created April 3, 2018 10:29
Show Gist options
  • Save ufocoder/86eda999be45a9858ad70535de2edbc9 to your computer and use it in GitHub Desktop.
Save ufocoder/86eda999be45a9858ad70535de2edbc9 to your computer and use it in GitHub Desktop.
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