The Architecture

the Elm Architecture is a simple pattern for infinitely nestable components. It is great for modularity, code reuse, and testing. Ultimately, this pattern makes it easy to create complex web apps in a way that stays modular

the Basic Pattern

the logic of every Elm program will break up into three cleanly separated parts:

You can pretty reliably start with the following skeleton and then iteratively fill in details for your particular case.

type alias Model = {...}

type Msg = Reset | Cancel | ...

  
update : msg -> Model -> Model
update a m =
  case a of
    Reset -> ...
    Cancel -> ...
    ...


view : Model -> Html Msg
view =  ...

This pattern is the essence of architecting Elm programs. Every example we see from now on will be a slight variation on this basic pattern: model, update, view.