Created
November 6, 2016 10:40
-
-
Save leggsimon/d5b7c55d086f25e294adfe15b4a33718 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
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