Elm in 7 minutes

InstructorRonn Ross

Share this video with your friends

Send Tweet

We are going to take a high-level look at what an Elm application looks like? We show how to structure apps, as well as, Elm’s elegant syntax by building a small app.

greg b
~ 8 years ago
import StartApp.Simple as StartApp
import Html.Events exposing (onClick)

main =
    StartApp.start
        {
            model = initialModel,
            view = view,
            update = update
        }

initialModel = 0

type Action
    = Increment
    | Decrement

update action model =
    case action of
        Increment ->
            model + 1
        Decrement ->
            model - 1

view address model =
    div []
        [
            button [onClick address Increment] [text "+"],
            div [] [text (toString model)],
            button [onClick address Decrement] [text "-"]
        ]
$ elm-package install evancz/elm-html
$ elm-package install evancz/start-app
$ elm make Main.elm --output=index.html
Song Yangyu
~ 8 years ago

Thinking would be helpful if a how to setup elm is provided

Dmitry
~ 3 years ago

I get UNFINISHED LIST error from «[ input [ type' "text"».