Skip to content

Instantly share code, notes, and snippets.

@Rockheung
Created March 23, 2018 06:03
Show Gist options
  • Save Rockheung/980efdedc03045efae8ec5cf1095dd80 to your computer and use it in GitHub Desktop.
Save Rockheung/980efdedc03045efae8ec5cf1095dd80 to your computer and use it in GitHub Desktop.
Skeleton of elm
module Main exposing (..)
import Html exposing (Html, div, text, program)
-- MODEL
type alias Model =
String
init : ( Model, Cmd Msg )
init =
( "Hello", Cmd.none )
-- MESSAGES
type Msg
= NoOp
-- VIEW
view : Model -> Html Msg
view model =
div []
[ text model ]
-- UPDATE
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
NoOp ->
( model, Cmd.none )
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
-- MAIN
main : Program Never Model Msg
main =
program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment