Documentation blocks have type Doc - documentation is a first-class value in the language. {{ starts a documentation block and }} finishes it. For example:
addingAndRemoving : Doc
addingAndRemoving =
use List +: :+ intersperse
{{
# Adding, removing, and replacing elements of lists
{+:} adds an element to the front of a list:
```
1 +: [2, 3, 4]
```
{:+} adds an element to the end of a list:
```
[1, 2, 3] :+ 4
```
{insertAt} inserts an element at any point in a list:
```
insertAt 1 "green" ["red", "blue"]
```
{intersperse} inserts an element between all the elements of a
list:
```
intersperse 0 [1, 2, 3]
```
{deleteAt} removes a specific element from a list:
```
deleteAt 2 [5, 3, 8, 9]
```
{replace} replaces a specific element with another one:
```
replace 1 "cheese" ["flour", "butter", "eggs"]
```
}}More specifically, some important Doc features are:
- Links to definitions are done with single open and close braces.
{List.drop}is a term link, and{type List}is a type link. @signature{List.take}or@inlineSignature{List.take}expands to the type signature of List.take either as a block or inline, respectively.@source{List.map}expands to the full source of List.map- To insert another Doc value into another Doc, use nested double braces.
{{I am a doc {{thisDocValueWillBeDisplayed}} }} @eval{someDefinition}expands to the result of evaluatingsomeDefinition, which must be a pre-existing definition in the codebase (it can't be an arbitrary expression). You can evaluate multi-line codeblocks with the triple backtick syntax``` multipleLines ```