Read
Elements are functions
Every HTML element is a function in Miso.Html.Element (imported here as H). It takes a list of attributes and a list of children and returns a View.
view :: Model -> View () () Model Action
view model =
H.div_ [ P.class_ "card" ]
[ H.h2_ [] [ "Shopping list" ]
, H.ul_ []
[ H.li_ [] [ "miso paste" ]
, H.li_ [] [ "tofu" ]
]
, H.p_ [] [ "Items: ", text (ms (2 :: Int)) ]
]Attributes live in Miso.Html.Property (P): P.class_, P.id_, P.href_, P.placeholder_ and so on. A string literal is a text node; for any other value use text with ms, which converts numbers and Strings to the text type miso uses, MisoString.
Because a view is ordinary Haskell, you can compute it: map over a list to make the items, use if to show or hide, pull parts into helper functions.