Created
January 1, 2016 20:23
-
-
Save bburdette/8c4b95151a6cae88c35e 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 StartApp exposing (start) | |
import Effects | |
import Task | |
import Html exposing (..) | |
import Html.Events exposing (..) | |
main = | |
(start | |
{ init = init | |
, update = update | |
, view = view | |
, inputs = [] | |
}).html | |
type Action | |
= Click | |
| Dummy | |
type alias Model = | |
{ clicks: Int | |
} | |
init : (Model, Effects.Effects Action) | |
init = (Model 0, Effects.none) | |
update : Action -> Model -> (Model, Effects.Effects Action) | |
update action model = | |
case action of | |
Click -> | |
(model, Effects.task (Task.succeed Dummy)) | |
Dummy -> | |
-- this never happens!! | |
({ model | clicks = model.clicks + 1}, Effects.none) | |
view : Signal.Address Action -> Model -> Html | |
view address model = | |
let start = button [ onClick address Click ] [ text (toString model.clicks) ] | |
in | |
div [] ([start]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment