Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import Html exposing (..)
import Html.App as Html
import Time exposing (Time, second)
import Html.Events exposing (..)
main =
Html.program
{ init = init
, update = update
, view = view
, subscriptions = subs
}
type alias Model = Time
type Msg
= Tick Time
| Clicked
init : (Model, Cmd Msg)
init = (0, Cmd.none)
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
Tick time ->
(time, Cmd.none)
Clicked ->
(0, Cmd.none)
view : Model -> Html Msg
view model =
div [] [text (toString model)
, button [onClick Clicked] [text "button"]
]
subs : Model -> Sub Msg
subs model =
Time.every second Tick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment