Skip to content

Instantly share code, notes, and snippets.

@nZac
Created July 10, 2016 23:29
Show Gist options
  • Save nZac/14b8e07ed5a019d5e582c21c517bab24 to your computer and use it in GitHub Desktop.
Save nZac/14b8e07ed5a019d5e582c21c517bab24 to your computer and use it in GitHub Desktop.
-- Compile to app.js
import Html exposing (Html, button, div, text)
import Html.App as App
import Html.Events exposing (onClick)
main =
App.beginnerProgram { model = 0, view = view, update = update }
type Msg = Increment | Decrement
update msg model =
case msg of
Increment ->
model + 1
Decrement ->
model - 1
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ text (toString model) ]
, button [ onClick Increment ] [ text "+" ]
]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title></title>
<script type="text/javascript" charset="utf-8" src="{{ url_for('static', filename='js/app.js') }} ">
</script>
</head>
<body>
<!-- Put elm app here -->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment