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