Skip to content

Instantly share code, notes, and snippets.

@leggsimon
Created November 6, 2016 10:40
Show Gist options
  • Save leggsimon/d5b7c55d086f25e294adfe15b4a33718 to your computer and use it in GitHub Desktop.
Save leggsimon/d5b7c55d086f25e294adfe15b4a33718 to your computer and use it in GitHub Desktop.
module Main exposing (..)
import Html exposing (Html, button, div, text, h1)
import Html.App as App
import Html.Events exposing (onClick)
main =
App.beginnerProgram { model = model, view = view, update = update }
-- MODEL
type alias Model =
{ dieFace : Int }
init : ( Model, Cmd Msg )
init =
( Model 1, Cmd.none )
-- UPDATE
type Msg
= Roll
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
Roll ->
( model, Cmd.none )
-- VIEW
view : Model -> Html Msg
view model =
div []
[ h1 [] [ text (toString model.dieFace) ]
, button [ onClick Roll ] [ text "Roll" ]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment