Fold template-haskell.git into ghc.git (re #8545)
[ghc.git] / libraries / template-haskell / Language / Haskell / TH.hs
1 {- | The public face of Template Haskell
2
3 For other documentation, refer to:
4 <http://www.haskell.org/haskellwiki/Template_Haskell>
5
6 -}
7 module Language.Haskell.TH(
8 -- * The monad and its operations
9 Q,
10 runQ,
11 -- ** Administration: errors, locations and IO
12 reportError, -- :: String -> Q ()
13 reportWarning, -- :: String -> Q ()
14 report, -- :: Bool -> String -> Q ()
15 recover, -- :: Q a -> Q a -> Q a
16 location, -- :: Q Loc
17 Loc(..),
18 runIO, -- :: IO a -> Q a
19 -- ** Querying the compiler
20 -- *** Reify
21 reify, -- :: Name -> Q Info
22 reifyModule,
23 thisModule,
24 Info(..), ModuleInfo(..),
25 InstanceDec,
26 ParentName,
27 Arity,
28 Unlifted,
29 -- *** Name lookup
30 lookupTypeName, -- :: String -> Q (Maybe Name)
31 lookupValueName, -- :: String -> Q (Maybe Name)
32 -- *** Instance lookup
33 reifyInstances,
34 isInstance,
35 -- *** Roles lookup
36 reifyRoles,
37 -- *** Annotation lookup
38 reifyAnnotations, AnnLookup(..),
39
40 -- * Typed expressions
41 TExp, unType,
42
43 -- * Names
44 Name, NameSpace, -- Abstract
45 -- ** Constructing names
46 mkName, -- :: String -> Name
47 newName, -- :: String -> Q Name
48 -- ** Deconstructing names
49 nameBase, -- :: Name -> String
50 nameModule, -- :: Name -> Maybe String
51 -- ** Built-in names
52 tupleTypeName, tupleDataName, -- Int -> Name
53 unboxedTupleTypeName, unboxedTupleDataName, -- :: Int -> Name
54
55 -- * The algebraic data types
56 -- | The lowercase versions (/syntax operators/) of these constructors are
57 -- preferred to these constructors, since they compose better with
58 -- quotations (@[| |]@) and splices (@$( ... )@)
59
60 -- ** Declarations
61 Dec(..), Con(..), Clause(..),
62 Strict(..), Foreign(..), Callconv(..), Safety(..), Pragma(..),
63 Inline(..), RuleMatch(..), Phases(..), RuleBndr(..), AnnTarget(..),
64 FunDep(..), FamFlavour(..), TySynEqn(..),
65 Fixity(..), FixityDirection(..), defaultFixity, maxPrecedence,
66 -- ** Expressions
67 Exp(..), Match(..), Body(..), Guard(..), Stmt(..), Range(..), Lit(..),
68 -- ** Patterns
69 Pat(..), FieldExp, FieldPat,
70 -- ** Types
71 Type(..), TyVarBndr(..), TyLit(..), Kind, Cxt, Pred, Syntax.Role(..),
72
73 -- * Library functions
74 -- ** Abbreviations
75 InfoQ, ExpQ, DecQ, DecsQ, ConQ, TypeQ, TyLitQ, CxtQ, PredQ, MatchQ, ClauseQ,
76 BodyQ, GuardQ, StmtQ, RangeQ, StrictTypeQ, VarStrictTypeQ, PatQ, FieldPatQ,
77 RuleBndrQ, TySynEqnQ,
78
79 -- ** Constructors lifted to 'Q'
80 -- *** Literals
81 intPrimL, wordPrimL, floatPrimL, doublePrimL, integerL, rationalL,
82 charL, stringL, stringPrimL,
83 -- *** Patterns
84 litP, varP, tupP, conP, uInfixP, parensP, infixP,
85 tildeP, bangP, asP, wildP, recP,
86 listP, sigP, viewP,
87 fieldPat,
88
89 -- *** Pattern Guards
90 normalB, guardedB, normalG, normalGE, patG, patGE, match, clause,
91
92 -- *** Expressions
93 dyn, global, varE, conE, litE, appE, uInfixE, parensE,
94 infixE, infixApp, sectionL, sectionR,
95 lamE, lam1E, lamCaseE, tupE, condE, multiIfE, letE, caseE, appsE,
96 listE, sigE, recConE, recUpdE, stringE, fieldExp,
97 -- **** Ranges
98 fromE, fromThenE, fromToE, fromThenToE,
99
100 -- ***** Ranges with more indirection
101 arithSeqE,
102 fromR, fromThenR, fromToR, fromThenToR,
103 -- **** Statements
104 doE, compE,
105 bindS, letS, noBindS, parS,
106
107 -- *** Types
108 forallT, varT, conT, appT, arrowT, equalityT, listT, tupleT, sigT, litT,
109 promotedT, promotedTupleT, promotedNilT, promotedConsT,
110 -- **** Type literals
111 numTyLit, strTyLit,
112 -- **** Strictness
113 isStrict, notStrict, strictType, varStrictType,
114 -- **** Class Contexts
115 cxt, normalC, recC, infixC, forallC,
116
117 -- *** Kinds
118 varK, conK, tupleK, arrowK, listK, appK, starK, constraintK,
119
120 -- *** Roles
121 nominalR, representationalR, phantomR, inferR,
122
123 -- *** Top Level Declarations
124 -- **** Data
125 valD, funD, tySynD, dataD, newtypeD,
126 -- **** Class
127 classD, instanceD, sigD,
128 -- **** Role annotations
129 roleAnnotD,
130 -- **** Type Family / Data Family
131 familyNoKindD, familyKindD, dataInstD,
132 closedTypeFamilyNoKindD, closedTypeFamilyKindD,
133 newtypeInstD, tySynInstD,
134 typeFam, dataFam, tySynEqn,
135 -- **** Foreign Function Interface (FFI)
136 cCall, stdCall, unsafe, safe, forImpD,
137 -- **** Pragmas
138 ruleVar, typedRuleVar,
139 pragInlD, pragSpecD, pragSpecInlD, pragSpecInstD, pragRuleD, pragAnnD,
140
141 -- * Pretty-printer
142 Ppr(..), pprint, pprExp, pprLit, pprPat, pprParendType
143
144 ) where
145
146 import Language.Haskell.TH.Syntax as Syntax
147 import Language.Haskell.TH.Lib
148 import Language.Haskell.TH.Ppr