Last active
November 5, 2018 20:06
-
-
Save kittykatattack/bfc18cef6ad9f91437fbe268c69f3901 to your computer and use it in GitHub Desktop.
Standard Elm boilerplate
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 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