Created
August 31, 2017 21:55
-
-
Save haplesshero13/8c4821c7d216386657528e468a87ee45 to your computer and use it in GitHub Desktop.
Template Elm program
This file contains hidden or 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 Html exposing (..) | |
import Html.App as Html | |
import Html.Events exposing (..) | |
-- MODEL | |
type alias Model = | |
{ content : String | |
} | |
model : (Model, Cmd Msg) | |
model = | |
(Model "Hello!", Cmd.none) | |
-- UPDATE | |
type Msg | |
= Reset | |
update : Msg -> Model -> (Model, Cmd Msg) | |
update msg model = | |
case msg of | |
Reset -> | |
(model, Cmd.none) | |
-- VIEW | |
view : Model -> Html Msg | |
view model = | |
h1 [] [ text model.content ] | |
-- SUBSCRIPTIONS | |
subscriptions : Model -> Sub Msg | |
subscriptions model = | |
Sub.none | |
-- APP | |
main = | |
Html.program | |
{ init = model | |
, view = view | |
, update = update | |
, subscriptions = subscriptions | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment