Skip to content

Instantly share code, notes, and snippets.

@lleveque
Created January 12, 2021 22:10
Show Gist options
  • Save lleveque/63792329222dca8cbed59fcf9c151f1e to your computer and use it in GitHub Desktop.
Save lleveque/63792329222dca8cbed59fcf9c151f1e to your computer and use it in GitHub Desktop.
Elm boilerplate for Browser.element
import Browser
import Html exposing (Html, text)
main = Browser.element
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}
type alias State = String
type Message = NOOP
-- The `init` signature defines which types your element will use to hold state and pass messages
init : () -> (State, Cmd Message)
init _ = ("This is the initial state", Cmd.none)
update : Message -> State -> (State, Cmd Message)
update message state = (state, Cmd.none)
subscriptions : State -> Sub Message
subscriptions state = Sub.none
view : State -> Html Message
view state = text state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment