The recommended way to structure your applications is dubbed 'the Elm Architecture.'
The simplest program consists of a model
record storing all data that might be updated, a union type Msg
that defines ways your program updates that data, a function update
which takes the model and a Msg
and returns a new model, and a function view
which takes a model and returns the HTML your page will display. Anytime a function returns a Msg
, the Elm runtime uses it to update the page.