1 .. _buildinfo-field-reference:
9 Field syntax is described as they are in the latest cabal file format version.
11 * terminals are enclosed in quotes and type set in typewriter script:
15 \mathord{"}\mathtt{example}\mathord{"}
17 * non-terminals are type set in italic:
21 \mathit{version\text-range}
23 * character sets are type set resembling regular expression notation:
28 [ \mathord{"}\mathtt{1}\mathord{"} \cdots \mathord{"}\mathtt{9}\mathord{"} ]
30 Character set complements have :math:`c` superscript:
34 [ \mathord{"}\mathtt{1}\mathord{"} \cdots \mathord{"}\mathtt{9}\mathord{"} ]^c
36 * repetition is type set using regular expression inspired notation.
37 Superscripts tell how many time to repeat:
38 The generic notation is :math:`\in[n\ldots5]`, however there
39 are common shorthands:
40 :math:`\ast` for :math:`\in[0\ldots\infty]` (``many``),
41 :math:`+` for :math:`\in[1\ldots\infty]` (``some``),
42 :math:`?` for :math:`\in[0\ldots1]` (``optional``).
44 Subscripts tell the used separator:
48 \mathit{digit}^+_{\mathord{"}\mathtt{.}\mathord{"}}
50 Would be ``digit(\.digit)*`` in common regex syntax.
52 * alternatives are listed in braces separated by vertical bar:
56 \{ \mathit{foo} \mid \mathit{bar} \}
58 In case of multiple alternatives, the stacked notation is used
62 \left\{\begin{gathered}
68 \end{gathered}\right\}
70 * parenthesis are used only for grouping:
74 \left(\mathit{foo} \mid \mathit{bar}\right)^+
76 * any amount of spaces, and at least single space are type set using
77 :math:`\circ` and :math:`\bullet` respectively.
78 They may appear standalone, not only as binary operators.
82 \mathit{module} \bullet \mathord{``}\mathtt{as}\mathord{"} \bullet \mathit{module}
84 * While notation is heavily regular expression inspired, there
85 are also fixed points, which allow represent recursive grammars
90 \mathbf{fix}\; \mathit{expr}\; \mathbf{in}\; \mathit{digit}
91 \mid \mathit{expr} \circ \mathord{``}\mathtt{+}\mathord{"} \circ \mathit{expr}
92 \mid \mathord{``}\mathtt{(} \mathord{"} \circ \mathit{expr} \circ \mathord{``}\mathtt{)}\mathord{"}
97 Many fields in cabal file format are lists. There are three variations:
100 Are used for lists of things with simple grammars, for example :pkg-field:`ghc-options`
106 Are used for lists of things with complicated grammars, for example :pkg-field:`build-depends`
107 There can be leading or trailing comma (but not both) since ``cabal-version: 2.2``.
108 Note, the comma cannot exist alone.
111 \mathrm{commalist}(\mathit{element}) =
114 Optional comma separated
115 Surprisingly many fields can have optional comma separator.
116 Since ``cabal-version: 3.0`` comma usage have to be consistent,
117 in other words either used everywhere or nowhere.
118 It's recommended to avoid using comma in these fields,
119 an example field is :pkg-field:`default-extensions`.
122 \mathrm{optcommalist}(\mathit{element}) =
128 In the syntax definitions below the following non-terminal symbols are used:
130 {% for production in productions %}
131 {{ production.name }}
132 {{ production.description }}
135 {{ production.syntax }}
142 {% for field in buildInfoFields %}
145 {% if notNull field.default %}
146 * Default: ``{{field.default}}``
148 {% if notNull field.availableSince %}
149 * Available since ``cabal-version: {{field.availableSince}}``.
151 {% if notNull field.deprecatedSince.fst %}
152 * Deprecated since ``cabal-version: {{field.deprecatedSince.fst}}``: {{field.deprecatedSince.snd}}
154 {% if notNull field.removedIn.fst %}
155 * Removed in ``cabal-version: {{field.removedIn.fst}}``: {{field.removedIn.snd}}
157 {# We show documentation link only for non deprecated fields #}
158 {% if null field.deprecatedSince.fst %}
159 {% if null field.removedIn.fst %}
160 * Documentation of :pkg-field:`{{field.name}}`
163 {% if notNull field.syntax %}
171 Package description fields
172 --------------------------
174 {% for field in packageDescriptionFields %}
177 {% if notNull field.default %}
178 * Default: ``{{field.default}}``
180 {% if notNull field.availableSince %}
181 * Available since ``cabal-version: {{field.availableSince}}``.
183 {% if notNull field.deprecatedSince.fst %}
184 * Deprecated since ``cabal-version: {{field.deprecatedSince.fst}}``: {{field.deprecatedSince.snd}}
186 {% if notNull field.removedIn.fst %}
187 * Removed in ``cabal-version: {{field.removedIn.fst}}``: {{field.removedIn.snd}}
189 {# We show documentation link only for non deprecated fields #}
190 {% if null field.deprecatedSince.fst %}
191 {% if null field.removedIn.fst %}
192 * Documentation of :pkg-field:`{{field.name}}`
195 {% if notNull field.syntax %}
206 {% for field in testSuiteFields %}
209 {% if notNull field.default %}
210 * Default: ``{{field.default}}``
212 {% if notNull field.availableSince %}
213 * Available since ``cabal-version: {{field.availableSince}}``.
215 {% if notNull field.deprecatedSince.fst %}
216 * Deprecated since ``cabal-version: {{field.deprecatedSince.fst}}``: {{field.deprecatedSince.snd}}
218 {% if notNull field.removedIn.fst %}
219 * Removed in ``cabal-version: {{field.removedIn.fst}}``: {{field.removedIn.snd}}
221 {# We show documentation link only for non deprecated fields #}
222 {% if null field.deprecatedSince.fst %}
223 {% if null field.removedIn.fst %}
224 * Documentation of :pkg-field:`test-suite:{{field.name}}`
227 {% if notNull field.syntax %}