HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Moduletemplate-haskell-2.25.0.0Haskell2010

Language.Haskell.TH.Lib

Language.Haskell.TH.Lib contains lots of useful helper functions for generating and manipulating Template Haskell terms

Contents
  1. Library functions
  2. Abbreviations
  3. Constructors lifted to Q
  4. Literals
  5. Patterns
  6. Pattern Guards
  7. Expressions
  8. Ranges
  9. Ranges with more indirection
  10. Statements
  11. Types
  12. Type literals
  13. Strictness
  14. Class Contexts
  15. Constructors
  16. Kinds
  17. Type variable binders
  18. Roles
  19. Top Level Declarations
  20. Data
  21. Class
  22. Role annotations
  23. Type Family / Data Family
  24. Fixity
  25. Default declaration
  26. Foreign Function Interface (FFI)
  27. Functional dependencies
  28. Pragmas
  29. Pattern Synonyms
  30. Implicit Parameters
  31. Reify
  32. Documentation
Synopsis

Library functions

Abbreviations

typetype TExpQ (a :: TYPE r) = Q (TExp a)

Representation-polymorphic since template-haskell-2.17.0.0.

Constructors lifted to Q

Literals

valuemkBytes
  1. :: ForeignPtr Word8

    Pointer to the data

  2. -> Word

    Offset from the pointer

  3. -> Word

    Number of bytes

  4. -> Bytes

Create a Bytes datatype representing raw bytes to be embedded into the program/library binary.

Patterns

Pattern Guards

Expressions

Ranges

Ranges with more indirection

Statements

Types

Type literals

Strictness

Class Contexts

valueclassP :: Quote m => Name -> [m Type] -> m Pred
#

Deprecated. As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please use conT and appT.

valueequalP :: Quote m => m Type -> m Type -> m Pred
#

Deprecated. As of template-haskell-2.10, constraint predicates (Pred) are just types (Type), in keeping with ConstraintKinds. Please see equalityT.

Constructors

Kinds

Type variable binders

Roles

Top Level Declarations

Data

datadata DerivClause

A single deriving clause at the end of a datatype declaration.

Constructors

Instances7Eq, Data, Ord, Show, Generic, Lift, …
datadata DerivStrategy

What the user explicitly requests when deriving an instance with -XDerivingStrategies.

Constructors

Instances7Eq, Data, Ord, Show, Generic, Lift, …

Class

datadata Overlap

Varieties of allowed instance overlap.

Constructors

Instances7Eq, Data, Ord, Show, Generic, Lift, …

Role annotations

Type Family / Data Family

Fixity

Default declaration

Foreign Function Interface (FFI)

Functional dependencies

Pragmas

Pattern Synonyms

Implicit Parameters

Reify

Documentation

valuewithDecDoc :: String -> Q Dec -> Q Dec

Attaches Haddock documentation to the declaration provided. Unlike putDoc, the names do not need to be in scope when calling this function so it can be used for quoted declarations and anything else currently being spliced. Not all declarations can have documentation attached to them. For those that can't, withDecDoc will return it unchanged without any side effects.