Skip to content

Instantly share code, notes, and snippets.

@haplesshero13
Created August 31, 2017 21:55
Show Gist options
  • Save haplesshero13/8c4821c7d216386657528e468a87ee45 to your computer and use it in GitHub Desktop.
Save haplesshero13/8c4821c7d216386657528e468a87ee45 to your computer and use it in GitHub Desktop.
Template Elm program
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