Last active
April 16, 2017 20:32
-
-
Save roine/c0e920ef851d0bff3217b54a8040cc85 to your computer and use it in GitHub Desktop.
bare minimum elm architechure for Elm 0.18
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
module Main exposing (..) | |
import Html exposing (..) | |
-- MODEL | |
type alias Model = | |
{ key : Int } | |
init : ( Model, Cmd Msg ) | |
init = | |
( initialModel, Cmd.none ) | |
initialModel : Model | |
initialModel = | |
{ key = 1 } | |
-- UPDATE | |
type Msg | |
= NoOp | |
update : Msg -> Model -> ( Model, Cmd Msg ) | |
update msg model = | |
case msg of | |
NoOp -> | |
model ! [] | |
-- SUBSCRIPTIONS | |
subscriptions : Model -> Sub Msg | |
subscriptions model = | |
Sub.batch [] | |
-- VIEW | |
view : Model -> Html Msg | |
view model = | |
div [] [ text "hello world" ] | |
-- INIT | |
main = | |
program | |
{ init = init | |
, update = update | |
, subscriptions = subscriptions | |
, view = view | |
} |
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
module Main exposing (..) | |
import Html exposing (..) | |
-- MODEL | |
type alias Model = | |
{ key : Int } | |
model : Model | |
model = | |
{ key = 1 } | |
-- UPDATE | |
type Msg | |
= NoOp | |
update : Msg -> Model -> Model | |
update msg model = | |
case msg of | |
NoOp -> | |
model | |
-- VIEW | |
view : Model -> Html Msg | |
view model = | |
div [] [ text "hello world" ] | |
-- INIT | |
main = | |
beginnerProgram | |
{ model = model | |
, update = update | |
, view = view | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment