Skip to content

Instantly share code, notes, and snippets.

@zkessin
Last active April 2, 2024 20:17
Show Gist options
  • Save zkessin/7391c68f943d94a127757c2c5ea12114 to your computer and use it in GitHub Desktop.
Save zkessin/7391c68f943d94a127757c2c5ea12114 to your computer and use it in GitHub Desktop.
Elm Architecture Hello world
module Main exposing (..)
{-
********************************************************************************
Copyright 2016 Zachary Kessin
Released under the BSD3 licence
Test your Code for better code quiality
http://elm-test.com/?utm_source=gist&utm_content=template
For Elm 0.17
********************************************************************************
-}
import Html exposing (..)
import Html.Attributes exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Navigation
type alias Model = ()
type Msg =
NoOp
init: a -> ( Model, Cmd Msg)
init _ =
((), Cmd.none)
update : Msg -> Model -> ( Model, Cmd Msg)
update event model=
case event of
NoOp ->
model ! []
updateUrl : String -> Model -> ( Model, Cmd Msg )
updateUrl path model =
model ! []
view: Model -> Html Msg
view _ =
div [][text "Hello World"]
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.batch []
main : Program Never
main =
let
parser =
Navigation.makeParser (\l -> l.pathname)
params =
{ init = init
, update = update
, urlUpdate = updateUrl
, view = view
, subscriptions = subscriptions
}
in
Navigation.program parser params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment