Skip to content

Instantly share code, notes, and snippets.

@kittykatattack
Last active November 5, 2018 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kittykatattack/bfc18cef6ad9f91437fbe268c69f3901 to your computer and use it in GitHub Desktop.
Save kittykatattack/bfc18cef6ad9f91437fbe268c69f3901 to your computer and use it in GitHub Desktop.
Standard Elm boilerplate
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