Writing HTML

Strings, numbers and lists of HTML are sub-types of html, so you can write HTML like this:

expression HTML output
1 1
"Hello" Hello
"<unsafe>" &lt;unsafe&gt;
[1, 2, 3, "Hello"] 123Hello

Any name enclosed in angle brackets is a tag function that has type htmlTag. You can build HTML using tag functions such as <p> and <div>, and they can optionally be provided attributes and child HTML.

expression HTML output type
<div> <div></div> htmlTag
<div> "hello" <div>hello</div> html
<div> { class = "someclass" } <div class="someclass"></div> htmlTagWithAttrs
<div> { class = "someclass" } "hello" <div class="someclass">hello</div> html
<div> [ div 1, div 2 ] <div><div>1</div><div>2</div></div> html

Attributes are records with fields of type text.