aboutsummaryrefslogtreecommitdiff
path: root/doc/cheatsheet/haddocks.md
blob: a34645845756af2ffb4a06a6c0af515a35e90ba8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Code Sections

```
  -- * Section
  -- ** Sub-section
  -- *** Sub-sub-section
  -- et cetera
```

# Named Documentation Chunks

```
  -- $name
[...]
  -- $name
  -- Here is the documentation text
  -- which is embedded elsewhere
```

# Code Blocks

```
With internal markup:
  -- @
  --   fact n = product [1..n]
  -- @
With literal text:
  -- > fact n = product [1..n]
```

# REPL Examples

```
  -- >>> fact 5
  -- 120
```

# Properties

```
  -- prop> a + b = b + a
```

# Hyperlinked Identifiers

```
  -- The value 'x' of type 'T'
  -- The out-of-scope 'MyModule.x'
  -- The "MyModule" module
```

# Textual Markup

```
  -- Emphasis: /forward slashes/.
  -- Bolding: __underscores__.
  -- Monospaced text: @ampersands@.
```

# Links and Images

```
  -- A raw link <http://example.com>
  -- [a link](http://example.com)
  -- ![description](imagepath.png)
```

# Lists

```
itemized with "*" or "-"
  -- * first item
  -- * second item
numbered with "(n)" or "n."
  -- 1. first item
  -- 2. second item
definitions with "[thing]"
  -- [one] first item
  -- [two] second item
```

# Mathematics/LaTeX

```
  -- \[
  --   f(n) = \Sum_{i=1}^{n} i
  -- \]
  \\ when \(n > 0\)
```

# Headings in Documentation

```
  -- = Heading
  -- == Sub-heading
  -- === Sub-sub-heading
```

# Metadata

```
  -- @since 1.2.3
```

# Module Attributes

```
{-# OPTIONS_HADDOCK hide #-}
  Omit this module from the docs
{-# OPTIONS_HADDOCK prune #-}
  Omit definitions without docs
{-# OPTIONS_HADDOCK ignore-exports #-}
  Treat this module as though all
  top-level items are exported
{-# OPTIONS_HADDOCK not-home #-}
  Do not treat this module as the
  "home" of identifiers it exports
{-# OPTIONS_HADDOCK show-extensions #-}
  Show all enabled LANGUAGE extensions
```

# Grid tables

```
+------------------------+------------+----------+----------+
| Header row, column 1   | Header 2   | Header 3 | Header 4 |
| (header rows optional) |            |          |          |
+========================+============+==========+==========+
| body row 1, column 1   | column 2   | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2             | Cells may span columns.          |
+------------------------+------------+---------------------+
| body row 3             | Cells may  | \[                  |
+------------------------+ span rows. | f(n) = \sum_{i=1}   |
| body row 4             |            | \]                  |
+------------------------+------------+---------------------+
```