blob: c34c30c450a642998805c598ce9ecceaf70bea71 [file] [log] [blame]
external-reality8f34d232014-02-22 21:35:47 -05001;;; shm-ast-documentation.el --- Documentation of the Haskell AST
2
3;; Copyright (c) 2013, Niklas Broberg, Chris Done. All rights reserved.
4
5;; This file is free software; you can redistribute it and/or modify
6;; it under the terms of the GNU General Public License as published by
7;; the Free Software Foundation; either version 3, or (at your option)
8;; any later version.
9
10;; This file is distributed in the hope that it will be useful,
11;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13;; GNU General Public License for more details.
14
15;; You should have received a copy of the GNU General Public License
16;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18;;; Commentary:
19
20;; Documentation for parts of the AST.
21
22;;; Code:
23
24(defvar shm-ast-documentation
25 '(("Module" "A complete Haskell source module"
26 ("Module" "An ordinary Haskell module"))
27
28 ("ModuleHead" "The head of a module, including the name and export specification")
29
30 ("WarningText" "Warning text to optionally use in the module header of e.g. a deprecated module")
31
32 ("ExportSpecList" "An explicit export specification")
33
34 ("ExportSpec" "An item in a module's export specification"
35 ("EVar" "Variable")
36 ("EAbs" "T: a class or datatype exported abstractly, or a type synonym")
37 ("EThingAll" "T(..): a class exported with all of its methods, or a datatype exported with all of its constructors")
38 ("EThingWith" "T(C_1,...,C_n): a class exported with some of its methods, or a datatype exported with some of its constructors")
39 ("EModuleContents" "module M: re-export a module"))
40
41 ("ImportDecl" "An import declaration")
42
43 ("ImportSpecList" "An explicit import specification list")
44
45 ("ImportSpec" "An import specification, representing a single explicit item imported (or hidden) from a module"
46 ("IVar" "Variable")
47 ("IAbs" "T: the name of a class, datatype or type synonym")
48 ("IThingAll" "T(..): a class imported with all of its methods, or a datatype imported with all of its constructors")
49 ("IThingWith" "T(C_1,...,C_n): a class imported with some of its methods, or a datatype imported with some of its constructors"))
50
51 ("Decl" "A top-level declaration"
52 ("TypeDecl" "A type declaration")
53 ("TypeFamDecl" "A type family declaration")
54 ("DataDecl" "A data OR newtype declaration")
55 ("GDataDecl" "A data OR newtype declaration, GADT style")
56 ("DataFamDecl" "A data family declaration")
57 ("TypeInsDecl" "A type family instance declaration")
58 ("DataInsDecl" "A data family instance declaration")
59 ("GDataInsDecl" "A data family instance declaration, GADT style")
60 ("ClassDecl" "A declaration of a type class")
61 ("InstDecl" "An declaration of a type class instance")
62 ("DerivDecl" "A standalone deriving declaration")
63 ("InfixDecl" "A declaration of operator fixity")
64 ("DefaultDecl" "A declaration of default types")
65 ("SpliceDecl" "Template Haskell splicing declaration")
66 ("TypeSig" "A type signature declaration")
67 ("FunBind" "A set of function binding clauses")
68 ("PatBind" "A pattern binding")
69 ("ForImp" "A foreign import declaration")
70 ("ForExp" "A foreign export declaration")
71 ("RulePragmaDecl" "A RULES pragma")
72 ("DeprPragmaDecl" "A DEPRECATED pragma")
73 ("WarnPragmaDecl" "A WARNING pragma")
74 ("InlineSig" "An INLINE pragma")
75 ("InlineConlikeSig" "An INLINE CONLIKE pragma")
76 ("SpecSig" "A SPECIALISE pragma")
77 ("SpecInlineSig" "A SPECIALISE INLINE pragma")
78 ("InstSig" "A SPECIALISE instance pragma")
79 ("AnnPragma" "An ANN pragma"))
80
81 ("DeclHead" "The head of a type or class declaration")
82
83 ("InstHead" "The head of an instance declaration")
84
85 ("Binds" "A binding group inside a let or where clause"
86 ("BDecls" "An ordinary binding group")
87 ("IPBinds" "A binding group for implicit parameters"))
88
89 ("IPBind" "A binding of an implicit parameter")
90
91 ("ClassDecl" "Declarations inside a class declaration"
92 ("ClsDecl" "Ordinary declaration")
93 ("ClsDataFam" "Declaration of an associated data type")
94 ("ClsTyFam" "Declaration of an associated type synonym")
95 ("ClsTyDef" "Default choice for an associated type synonym"))
96
97 ("InstDecl" "Declarations inside an instance declaration"
98 ("InsDecl" "Ordinary declaration")
99 ("InsType" "An associated type definition")
100 ("InsData" "An associated data type implementation")
101 ("InsGData" "An associated data type implemented using GADT style"))
102
103 ("Deriving" "A deriving clause following a data type declaration")
104
105 ("ConDecl" "Declaration of an ordinary data constructor"
106 ("ConDecl" "Ordinary data constructor")
107 ("InfixConDecl" "Infix data constructor")
108 ("RecDecl" "Record constructor"))
109
110 ("FieldDecl" "Declaration of a (list of) named field(s)")
111
112 ("QualConDecl" "A single constructor declaration within a data type declaration, which may have an existential quantification binding")
113
114 ("GadtDecl" "A single constructor declaration in a GADT data type declaration")
115
116 ("BangType" "The type of a constructor argument or field, optionally including a strictness annotation"
117 ("BangedTy" "Strict component, marked with \"!\"")
118 ("UnBangedTy" "Non-strict component")
119 ("UnpackedTy" "Unboxed component, marked with an UNPACK pragma"))
120
121 ("Match" "Clauses of a function binding"
122 ("Match" "A clause defined with prefix notation, i.e. the function name followed by its argument patterns, the right-hand side and an optional where clause")
123 ("InfixMatch" "A clause defined with infix notation, i.e. first its first argument pattern, then the function name, then its following argument(s), the right-hand side and an optional where clause. Note that there can be more than two arguments to a function declared infix, hence the list of pattern arguments"))
124
125 ("Rhs" "The right hand side of a function or pattern binding"
126 ("UnGuardedRhs" "Unguarded right hand side (exp)")
127 ("GuardedRhss" "Guarded right hand side (gdrhs)"))
128
129 ("GuardedRhs" "A guarded right hand side | stmts = exp. The guard is a series of statements when using pattern guards, otherwise it will be a single qualifier expression")
130
131 ("Context" "A context is a set of assertions")
132
133 ("FunDep" "A functional dependency, given on the form l1 l2 ... ln -> r2 r3 .. rn")
134
135 ("Asst" "Class assertion. In Haskell 98, the argument would be a tyvar, but this definition allows multiple parameters, and allows them to be types. Also extended with support for implicit parameters and equality constraints"
136 ("ClassA" "Ordinary class assertion")
137 ("InfixA" "Class assertion where the class name is given infix")
138 ("IParam" "Implicit parameter assertion")
139 ("EqualP" "Type equality constraint"))
140
141 ("Type" "A type qualified with a context. An unqualified type has an empty context"
142 ("TyForall" "Qualified type")
143 ("TyFun" "Function type")
144 ("TyTuple" "Tuple type, possibly boxed")
145 ("TyList" "List syntax, e.g. [a], as opposed to [] a")
146 ("TyApp" "Application of a type constructor")
147 ("TyVar" "Type variable")
148 ("TyCon" "Named type or type constructor")
149 ("TyParen" "Type surrounded by parentheses")
150 ("TyInfix" "Infix type constructor")
151 ("TyKind" "Type with explicit kind signature"))
152
153 ("Kind" "An explicit kind annotation"
154 ("KindStar" "* , the kind of types")
155 ("KindBang" "!, the kind of unboxed types")
156 ("KindFn" "->, the kind of a type constructor")
157 ("KindParen" "A parenthesised kind")
158 ("KindVar" "A kind variable (as-of-yet unsupported by compilers)"))
159
160 ("TyVarBind" "A type variable declaration, optionally with an explicit kind annotation"
161 ("KindedVar" "Variable binding with kind annotation")
162 ("UnkindedVar" "Ordinary variable binding"))
163
164 ("Exp" "Haskell expression"
165 ("Var" "Variable")
166 ("IPVar" "Implicit parameter variable")
167 ("Con" "Data constructor")
168 ("Lit" "Literal constant")
169 ("InfixApp" "Infix application")
170 ("App" "Ordinary application")
171 ("NegApp" "Negation expression -exp (unary minus)")
172 ("Lambda" "Lambda expression")
173 ("Let" "Local declarations with let ... in .")
174 ("If" "if exp then exp else exp")
175 ("Case" "case exp of alts")
176 ("Do" "do-expression: the last statement in the list should be an expression")
177 ("MDo" "mdo-expression")
178 ("Tuple" "Tuple expression")
179 ("TupleSection" "Tuple section expression, e.g. (,,3)")
180 ("List" "List expression")
181 ("Paren" "Parenthesised expression")
182 ("LeftSection" "Left section (exp qop)")
183 ("RightSection" "Right section (qop exp)")
184 ("RecConstr" "Record construction expression")
185 ("RecUpdate" "Record update expression")
186 ("EnumFrom" "Unbounded arithmetic sequence, incrementing by 1: [from ..]")
187 ("EnumFromTo" "Bounded arithmetic sequence, incrementing by 1 [from .. to]")
188 ("EnumFromThen" "Unbounded arithmetic sequence, with first two elements given [from, then ..]")
189 ("EnumFromThenTo" "Bounded arithmetic sequence, with first two elements given [from, then .. to]")
190 ("ListComp" "Ordinary list comprehension")
191 ("ParComp" "Parallel list comprehension")
192 ("ExpTypeSig" "Expression with explicit type signature")
193 ("VarQuote" "'x for template haskell reifying of expressions")
194 ("TypQuote" "''T for template haskell reifying of types")
195 ("BracketExp" "Template haskell bracket expression")
196 ("SpliceExp" "Template haskell splice expression")
197 ("QuasiQuote" "Quasi-quotaion: [$name| string |]")
198 ("XTag" "Xml element, with attributes and children")
199 ("XETag" "Empty xml element, with attributes")
200 ("XPcdata" "PCDATA child element")
201 ("XExpTag" "Escaped haskell expression inside xml")
202 ("XChildTag" "Children of an xml element")
203 ("CorePragma" "CORE pragma")
204 ("SCCPragma" "SCC pragma")
205 ("GenPragma" "GENERATED pragma")
206 ("Proc" "Arrows proc: proc pat -> exp")
207 ("LeftArrApp" "Arrow application (from left): exp -< exp")
208 ("RightArrApp" "Arrow application (from right): exp >- exp")
209 ("LeftArrHighApp" "Higher-order arrow application (from left): exp -<< exp")
210 ("RightArrHighApp" "Higher-order arrow application (from right): exp >>- exp"))
211
212 ("Stmt" "A statement, representing both a stmt in a do-expression, an ordinary qual in a list comprehension, as well as a stmt in a pattern guard"
213 ("Generator" "A generator: pat <- exp")
214 ("Qualifier" "An exp by itself: in a do-expression, an action whose result is discarded; in a list comprehension and pattern guard, a guard expression")
215 ("LetStmt" "Local bindings")
216 ("RecStmt" "A recursive binding group for arrows"))
217
218 ("QualStmt" "A general transqual in a list comprehension, which could potentially be a transform of the kind enabled by TransformListComp"
219 ("QualStmt" "An ordinary statement")
220 ("ThenTrans" "then exp")
221 ("ThenBy" "then exp by exp")
222 ("GroupBy" "then group by exp")
223 ("GroupUsing" "then group using exp")
224 ("GroupByUsing" "then group by exp using exp"))
225
226 ("FieldUpdate" "An fbind in a labeled construction or update expression"
227 ("FieldUpdate" "Ordinary label-expresion pair")
228 ("FieldPun" "Record field pun")
229 ("FieldWildcard" "Record field wildcard"))
230
231 ("Alt" "An alt alternative in a case expression")
232
233 ("GuardedAlts" "The right-hand sides of a case alternative, which may be a single right-hand side or a set of guarded ones"
234 ("UnGuardedAlt" "-> exp")
235 ("GuardedAlts" "gdpat"))
236
237 ("GuardedAlt" "A guarded case alternative | stmts -> exp")
238
239 ("Pat" "A pattern, to be matched against a value"
240 ("PVar" "Variable")
241 ("PLit" "Literal constant")
242 ("PNeg" "Negated pattern")
243 ("PNPlusK" "Integer n+k pattern")
244 ("PInfixApp" "Pattern with an infix data constructor")
245 ("PApp" "Data constructor and argument patterns")
246 ("PTuple" "Tuple pattern")
247 ("PList" "List pattern")
248 ("PParen" "Parenthesized pattern")
249 ("PRec" "Labelled pattern, record style")
250 ("PAsPat" "@-pattern")
251 ("PWildCard" "Wildcard pattern: _")
252 ("PIrrPat" "Irrefutable pattern: ~pat")
253 ("PatTypeSig" "Pattern with type signature")
254 ("PViewPat" "View patterns of the form (exp -> pat)")
255 ("PRPat" "Regular list pattern")
256 ("PXTag" "XML element pattern")
257 ("PXETag" "XML singleton element pattern")
258 ("PXPcdata" "XML PCDATA pattern")
259 ("PXPatTag" "XML embedded pattern")
260 ("PXRPats" "XML regular list pattern")
261 ("PExplTypeArg" "Explicit generics style type argument e.g. f {| Int |} x = .")
262 ("PQuasiQuote" "String quasi quote pattern: [$name| string |]")
263 ("PBangPat" "Strict (bang) pattern: f !x = .."))
264
265 ("PatField" "An fpat in a labeled record pattern"
266 ("PFieldPat" "Ordinary label-pattern pair")
267 ("PFieldPun" "Record field pun")
268 ("PFieldWildcard" "Record field wildcard"))
269
270 ("Literal" "Literal Values of this type hold the abstract value of the literal, along with the precise string representation used. For example, 10, 0o12 and 0xa have the same value representation, but each carry a different string representation"
271 ("Char" "Character literal")
272 ("String" "String literal")
273 ("Int" "Integer literal")
274 ("Frac" "Floating point literal")
275 ("PrimInt" "Unboxed integer literal")
276 ("PrimWord" "Unboxed word literal")
277 ("PrimFloat" "Unboxed float literal")
278 ("PrimDouble" "Unboxed double literal")
279 ("PrimChar" "Character literal")
280 ("PrimString" "String literal"))
281
282 ("ModuleName" "The name of a Haskell module")
283
284 ("QName" "This type is used to represent qualified variables, and also qualified constructors"
285 ("Qual" "Name qualified with a module name")
286 ("UnQual" "Unqualified local name")
287 ("Special" "Built-in constructor with special syntax"))
288
289 ("Name" "This type is used to represent variables, and also constructors"
290 ("Ident" "varid or conid")
291 ("Symbol" "varsym or consym"))
292
293 ("QOp" "Possibly qualified infix operators (qop), appearing in expressions"
294 ("QVarOp" "Variable operator (qvarop)")
295 ("QConOp" "Constructor operator (qconop)"))
296
297 ("Op" "Operators appearing in infix declarations are never qualified"
298 ("VarOp" "Variable operator (varop)")
299 ("ConOp" "Constructor operator (conop)"))
300
301 ("SpecialCon" "Constructors with special syntax. These names are never qualified, and always refer to builtin type or data constructors"
302 ("UnitCon" "Unit type and data constructor ()")
303 ("ListCon" "List type constructor []")
304 ("FunCon" "Function type constructor ->")
305 ("TupleCon" "N-ary tuple type and data constructors (,) etc, possibly boxed (#,#)")
306 ("Cons" "Data constructor (:)")
307 ("UnboxedSingleCon" "Unboxed singleton tuple constructor (# #)"))
308
309 ("CName" "A name (cname) of a component of a class or data type in an import or export specification"
310 ("VarName" "Name of a method or field")
311 ("ConName" "Name of a data constructor"))
312
313 ("IPName" "An implicit parameter name"
314 ("IPDup" "?ident, non-linear implicit parameter")
315 ("IPLin" "%ident, linear implicit parameter"))
316
317 ("Bracket" "A template haskell bracket expression"
318 ("ExpBracket" "Expression bracket: [| ... |]")
319 ("PatBracket" "Pattern bracket: [p| ... |]")
320 ("TypeBracket" "Type bracket: [t| ... |]")
321 ("DeclBracket" "Declaration bracket: [d| ... |]"))
322
323 ("Splice" "A template haskell splice expression"
324 ("IdSplice" "Variable splice: $var")
325 ("ParenSplice" "Parenthesised expression splice: $(exp)"))
326
327 ("Safety" "The safety of a foreign function call"
328 ("PlayRisky" "Unsafe")
329 ("PlaySafe" "Safe (False) or threadsafe (True)")
330 ("PlayInterruptible" "Interruptible"))
331
332 ("CallConv" "The calling convention of a foreign function call")
333
334 ("ModulePragma" "A top level options pragma, preceding the module header"
335 ("LanguagePragma" "LANGUAGE pragma")
336 ("OptionsPragma" "OPTIONS pragma, possibly qualified with a tool, e.g. OPTIONS_GHC")
337 ("AnnModulePragma" "ANN pragma with module scope"))
338
339 ("Rule" "The body of a RULES pragma")
340 ("RuleVar" "Variables used in a RULES pragma, optionally annotated with types")
341 ("Activation" "Activation clause of a RULES pragma")
342
343 ("Annotation" "An annotation through an ANN pragma"
344 ("Ann" "An annotation for a declared name")
345 ("TypeAnn" "An annotation for a declared type")
346 ("ModuleAnn" "An annotation for the defining module")))
347 "Documentation describing every node type and every constructor in the AST")
348
349(provide 'shm-ast-documentation)
350
351;;; shm-ast-documentation.el ends here