Course map
miso // 02

What is miso?

Read

Three parts

miso is a Haskell framework for user interfaces, in the tradition of Elm and React. Every miso application is a Component with three parts:

  • model: the state. Any Haskell value: a number, a record, a list.
  • update: how an action (a click, a timer, a message) changes the model.
  • view: a function from the model to HTML. Whenever the model changes, the view is called again and miso patches the page.
app :: App Int Action
app = component 0 update view

component takes the three parts, in that order. The model here is an Int starting at 0. The whole page is drawn from it, and only from it: there is no DOM to keep in sync by hand.

01 / 05