summaryrefslogtreecommitdiff
path: root/libraries/template-haskell/Language/Haskell/TH.hs
blob: 6179fca7e93fb2c60a74f849cb581f2cd20d650d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{- | The public face of Template Haskell

For other documentation, refer to:
<http://www.haskell.org/haskellwiki/Template_Haskell>

-}
{-# LANGUAGE Safe #-}
module Language.Haskell.TH(
        -- * The monad and its operations
        Q,
        runQ,
        Quote(..),
        -- ** Administration: errors, locations and IO
        reportError,              -- :: String -> Q ()
        reportWarning,            -- :: String -> Q ()
        report,                   -- :: Bool -> String -> Q ()
        recover,          -- :: Q a -> Q a -> Q a
        location,         -- :: Q Loc
        Loc(..),
        runIO,            -- :: IO a -> Q a
        -- ** Querying the compiler
        -- *** Reify
        reify,            -- :: Name -> Q Info
        reifyModule,
        newDeclarationGroup,
        Info(..), ModuleInfo(..),
        InstanceDec,
        ParentName,
        SumAlt, SumArity,
        Arity,
        Unlifted,
        -- *** Language extension lookup
        Extension(..),
        extsEnabled, isExtEnabled,
        -- *** Name lookup
        lookupTypeName,  -- :: String -> Q (Maybe Name)
        lookupValueName, -- :: String -> Q (Maybe Name)
        -- *** Fixity lookup
        reifyFixity,
        -- *** Type lookup
        reifyType,
        -- *** Instance lookup
        reifyInstances,
        isInstance,
        -- *** Roles lookup
        reifyRoles,
        -- *** Annotation lookup
        reifyAnnotations, AnnLookup(..),
        -- *** Constructor strictness lookup
        reifyConStrictness,

        -- * Typed expressions
        TExp, unType,
        Code(..), unTypeCode, unsafeCodeCoerce, hoistCode, bindCode,
        bindCode_, joinCode, liftCode,

        -- * Names
        Name, NameSpace,        -- Abstract
        -- ** Constructing names
        mkName,         -- :: String -> Name
        -- ** Deconstructing names
        nameBase,       -- :: Name -> String
        nameModule,     -- :: Name -> Maybe String
        namePackage,    -- :: Name -> Maybe String
        nameSpace,      -- :: Name -> Maybe NameSpace
        -- ** Built-in names
        tupleTypeName, tupleDataName,   -- Int -> Name
        unboxedTupleTypeName, unboxedTupleDataName, -- :: Int -> Name
        unboxedSumTypeName, -- :: SumArity -> Name
        unboxedSumDataName, -- :: SumAlt -> SumArity -> Name

    -- * The algebraic data types
    -- | The lowercase versions (/syntax operators/) of these constructors are
    -- preferred to these constructors, since they compose better with
    -- quotations (@[| |]@) and splices (@$( ... )@)

    -- ** Declarations
        Dec(..), Con(..), Clause(..),
        SourceUnpackedness(..), SourceStrictness(..), DecidedStrictness(..),
        Bang(..), Strict, Foreign(..), Callconv(..), Safety(..), Pragma(..),
        Inline(..), RuleMatch(..), Phases(..), RuleBndr(..), AnnTarget(..),
        FunDep(..), TySynEqn(..), TypeFamilyHead(..),
        Fixity(..), FixityDirection(..), defaultFixity, maxPrecedence,
        PatSynDir(..), PatSynArgs(..),
    -- ** Expressions
        Exp(..), Match(..), Body(..), Guard(..), Stmt(..), Range(..), Lit(..),
    -- ** Patterns
        Pat(..), FieldExp, FieldPat,
    -- ** Types
        Type(..), TyVarBndr(..), TyLit(..), Kind, Cxt, Pred, Syntax.Role(..),
        Syntax.Specificity(..),
        FamilyResultSig(..), Syntax.InjectivityAnn(..), PatSynType, BangType, VarBangType,

    -- ** Documentation
        putDoc, getDoc, DocLoc(..),

    -- * Library functions
    module Language.Haskell.TH.Lib,

    -- * Pretty-printer
    Ppr(..), pprint, pprExp, pprLit, pprPat, pprParendType

   ) where

import Language.Haskell.TH.Syntax as Syntax
import Language.Haskell.TH.Lib
import Language.Haskell.TH.Ppr