Add Fixity info for infix types
[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 -- *** Fixity lookup
33 reifyFixity,
34 -- *** Instance lookup
35 reifyInstances,
36 isInstance,
37 -- *** Roles lookup
38 reifyRoles,
39 -- *** Annotation lookup
40 reifyAnnotations, AnnLookup(..),
41
42 -- * Typed expressions
43 TExp, unType,
44
45 -- * Names
46 Name, NameSpace, -- Abstract
47 -- ** Constructing names
48 mkName, -- :: String -> Name
49 newName, -- :: String -> Q Name
50 -- ** Deconstructing names
51 nameBase, -- :: Name -> String
52 nameModule, -- :: Name -> Maybe String
53 -- ** Built-in names
54 tupleTypeName, tupleDataName, -- Int -> Name
55 unboxedTupleTypeName, unboxedTupleDataName, -- :: Int -> Name
56
57 -- * The algebraic data types
58 -- | The lowercase versions (/syntax operators/) of these constructors are
59 -- preferred to these constructors, since they compose better with
60 -- quotations (@[| |]@) and splices (@$( ... )@)
61
62 -- ** Declarations
63 Dec(..), Con(..), Clause(..),
64 Strict(..), Foreign(..), Callconv(..), Safety(..), Pragma(..),
65 Inline(..), RuleMatch(..), Phases(..), RuleBndr(..), AnnTarget(..),
66 FunDep(..), FamFlavour(..), TySynEqn(..),
67 Fixity(..), FixityDirection(..), defaultFixity, maxPrecedence,
68 -- ** Expressions
69 Exp(..), Match(..), Body(..), Guard(..), Stmt(..), Range(..), Lit(..),
70 -- ** Patterns
71 Pat(..), FieldExp, FieldPat,
72 -- ** Types
73 Type(..), TyVarBndr(..), TyLit(..), Kind, Cxt, Pred, Syntax.Role(..),
74
75 -- * Library functions
76 -- ** Abbreviations
77 InfoQ, ExpQ, DecQ, DecsQ, ConQ, TypeQ, TyLitQ, CxtQ, PredQ, MatchQ, ClauseQ,
78 BodyQ, GuardQ, StmtQ, RangeQ, StrictTypeQ, VarStrictTypeQ, PatQ, FieldPatQ,
79 RuleBndrQ, TySynEqnQ,
80
81 -- ** Constructors lifted to 'Q'
82 -- *** Literals
83 intPrimL, wordPrimL, floatPrimL, doublePrimL, integerL, rationalL,
84 charL, stringL, stringPrimL, charPrimL,
85 -- *** Patterns
86 litP, varP, tupP, conP, uInfixP, parensP, infixP,
87 tildeP, bangP, asP, wildP, recP,
88 listP, sigP, viewP,
89 fieldPat,
90
91 -- *** Pattern Guards
92 normalB, guardedB, normalG, normalGE, patG, patGE, match, clause,
93
94 -- *** Expressions
95 dyn, global, varE, conE, litE, appE, uInfixE, parensE, staticE,
96 infixE, infixApp, sectionL, sectionR,
97 lamE, lam1E, lamCaseE, tupE, condE, multiIfE, letE, caseE, appsE,
98 listE, sigE, recConE, recUpdE, stringE, fieldExp,
99 -- **** Ranges
100 fromE, fromThenE, fromToE, fromThenToE,
101
102 -- ***** Ranges with more indirection
103 arithSeqE,
104 fromR, fromThenR, fromToR, fromThenToR,
105 -- **** Statements
106 doE, compE,
107 bindS, letS, noBindS, parS,
108
109 -- *** Types
110 forallT, varT, conT, appT, arrowT, infixT, uInfixT, parensT, equalityT,
111 listT, tupleT, sigT, litT, promotedT, promotedTupleT, promotedNilT,
112 promotedConsT,
113 -- **** Type literals
114 numTyLit, strTyLit,
115 -- **** Strictness
116 isStrict, notStrict, strictType, varStrictType,
117 -- **** Class Contexts
118 cxt, classP, equalP, normalC, recC, infixC, forallC,
119
120 -- *** Kinds
121 varK, conK, tupleK, arrowK, listK, appK, starK, constraintK,
122
123 -- *** Roles
124 nominalR, representationalR, phantomR, inferR,
125
126 -- *** Top Level Declarations
127 -- **** Data
128 valD, funD, tySynD, dataD, newtypeD,
129 -- **** Class
130 classD, instanceD, sigD, standaloneDerivD, defaultSigD,
131 -- **** Role annotations
132 roleAnnotD,
133 -- **** Type Family / Data Family
134 familyNoKindD, familyKindD, dataInstD,
135 closedTypeFamilyNoKindD, closedTypeFamilyKindD,
136 newtypeInstD, tySynInstD,
137 typeFam, dataFam, tySynEqn,
138 -- **** Foreign Function Interface (FFI)
139 cCall, stdCall, cApi, prim, javaScript,
140 unsafe, safe, forImpD,
141 -- **** Pragmas
142 ruleVar, typedRuleVar,
143 pragInlD, pragSpecD, pragSpecInlD, pragSpecInstD, pragRuleD, pragAnnD,
144 pragLineD,
145
146 -- * Pretty-printer
147 Ppr(..), pprint, pprExp, pprLit, pprPat, pprParendType
148
149 ) where
150
151 import Language.Haskell.TH.Syntax as Syntax
152 import Language.Haskell.TH.Lib
153 import Language.Haskell.TH.Ppr