| Safe Haskell | Trustworthy |
|---|---|
| Language | Haskell2010 |
GHC.Internal.TH.Lift
Contents
Description
This module gives the definition of the Lift class.
This is an internal module. Please import Language.Haskell.TH.Lift, Language.Haskell.TH or Language.Haskell.TH.Syntax instead!
Documentation
class Lift (t :: TYPE r) where #
A Lift instance can have any of its values turned into a Template
Haskell expression. This is needed when a value used within a Template
Haskell quotation is bound outside the Oxford brackets ([| ... |] or
[|| ... ||]) but not at the top level. As an example:
add1 :: Int -> Code Q Int add1 x = [|| x + 1 ||]
Template Haskell has no way of knowing what value x will take on at
splice-time, so it requires the type of x to be an instance of Lift.
A Lift instance must satisfy $(lift x) ≡ x and $$(liftTyped x) ≡ x
for all x, where $(...) and $$(...) are Template Haskell splices.
It is additionally expected that .lift x ≡ unTypeCode (liftTyped x)
Lift instances can be derived automatically by use of the -XDeriveLift
GHC language extension:
{-# LANGUAGE DeriveLift #-}
module Foo where
import Language.Haskell.TH.Syntax
data Bar a = Bar1 a (Bar a) | Bar2 String
deriving LiftRepresentation-polymorphic since template-haskell-2.16.0.0.
This is exposed both from the template-haskell-lift and template-haskell packages.
Consider importing it from the more stable template-haskell-lift if you don't need the full breadth of the template-haskell interface.
Minimal complete definition
Methods
lift :: Quote m => t -> m Exp #
Turn a value into a Template Haskell expression, suitable for use in a splice.
liftTyped :: forall (m :: Type -> Type). Quote m => t -> Code m t #
Turn a value into a Template Haskell typed expression, suitable for use in a typed splice.
Since: template-haskell-2.16.0.0
Instances
| Lift Addr# # | Produces an Since: template-haskell-2.16.0.0 |
| Lift Double# # | Since: template-haskell-2.16.0.0 |
| Lift Float# # | Since: template-haskell-2.16.0.0 |
| Lift Int# # | Since: template-haskell-2.16.0.0 |
| Lift Void # | Since: template-haskell-2.15.0.0 |
| Lift ForeignSrcLang # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => ForeignSrcLang -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ForeignSrcLang -> Code m ForeignSrcLang # | |
| Lift Int16 # | |
| Lift Int32 # | |
| Lift Int64 # | |
| Lift Int8 # | |
| Lift Extension # | Since: template-haskell-2.22.1.0 |
| Lift AnnLookup # | Since: template-haskell-2.22.1.0 |
| Lift AnnTarget # | Since: template-haskell-2.22.1.0 |
| Lift Bang # | Since: template-haskell-2.22.1.0 |
| Lift BndrVis # | Since: template-haskell-2.22.1.0 |
| Lift Body # | Since: template-haskell-2.22.1.0 |
| Lift Bytes # | Since: template-haskell-2.22.1.0 |
| Lift Callconv # | Since: template-haskell-2.22.1.0 |
| Lift Clause # | Since: template-haskell-2.22.1.0 |
| Lift Con # | Since: template-haskell-2.22.1.0 |
| Lift Dec # | Since: template-haskell-2.22.1.0 |
| Lift DecidedStrictness # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => DecidedStrictness -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => DecidedStrictness -> Code m DecidedStrictness # | |
| Lift DerivClause # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => DerivClause -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => DerivClause -> Code m DerivClause # | |
| Lift DerivStrategy # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => DerivStrategy -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => DerivStrategy -> Code m DerivStrategy # | |
| Lift DocLoc # | Since: template-haskell-2.22.1.0 |
| Lift Exp # | Since: template-haskell-2.22.1.0 |
| Lift FamilyResultSig # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => FamilyResultSig -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => FamilyResultSig -> Code m FamilyResultSig # | |
| Lift Fixity # | Since: template-haskell-2.22.1.0 |
| Lift FixityDirection # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => FixityDirection -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => FixityDirection -> Code m FixityDirection # | |
| Lift Foreign # | Since: template-haskell-2.22.1.0 |
| Lift FunDep # | Since: template-haskell-2.22.1.0 |
| Lift Guard # | Since: template-haskell-2.22.1.0 |
| Lift Info # | Since: template-haskell-2.22.1.0 |
| Lift InjectivityAnn # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => InjectivityAnn -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => InjectivityAnn -> Code m InjectivityAnn # | |
| Lift Inline # | Since: template-haskell-2.22.1.0 |
| Lift Lit # | Since: template-haskell-2.22.1.0 |
| Lift Loc # | Since: template-haskell-2.22.1.0 |
| Lift Match # | Since: template-haskell-2.22.1.0 |
| Lift ModName # | Since: template-haskell-2.22.1.0 |
| Lift Module # | Since: template-haskell-2.22.1.0 |
| Lift Name # | Since: template-haskell-2.22.1.0 |
| Lift NameFlavour # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => NameFlavour -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NameFlavour -> Code m NameFlavour # | |
| Lift NameIs # | Since: template-haskell-2.22.1.0 |
| Lift NameSpace # | Since: template-haskell-2.22.1.0 |
| Lift NamespaceSpecifier # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => NamespaceSpecifier -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NamespaceSpecifier -> Code m NamespaceSpecifier # | |
| Lift OccName # | Since: template-haskell-2.22.1.0 |
| Lift Overlap # | Since: template-haskell-2.22.1.0 |
| Lift Pat # | Since: template-haskell-2.22.1.0 |
| Lift PatSynArgs # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => PatSynArgs -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => PatSynArgs -> Code m PatSynArgs # | |
| Lift PatSynDir # | Since: template-haskell-2.22.1.0 |
| Lift Phases # | Since: template-haskell-2.22.1.0 |
| Lift PkgName # | Since: template-haskell-2.22.1.0 |
| Lift Pragma # | Since: template-haskell-2.22.1.0 |
| Lift Range # | Since: template-haskell-2.22.1.0 |
| Lift Role # | Since: template-haskell-2.22.1.0 |
| Lift RuleBndr # | Since: template-haskell-2.22.1.0 |
| Lift RuleMatch # | Since: template-haskell-2.22.1.0 |
| Lift Safety # | Since: template-haskell-2.22.1.0 |
| Lift SourceStrictness # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => SourceStrictness -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => SourceStrictness -> Code m SourceStrictness # | |
| Lift SourceUnpackedness # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => SourceUnpackedness -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => SourceUnpackedness -> Code m SourceUnpackedness # | |
| Lift Specificity # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => Specificity -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Specificity -> Code m Specificity # | |
| Lift Stmt # | Since: template-haskell-2.22.1.0 |
| Lift TyLit # | Since: template-haskell-2.22.1.0 |
| Lift TySynEqn # | Since: template-haskell-2.22.1.0 |
| Lift Type # | Since: template-haskell-2.22.1.0 |
| Lift TypeFamilyHead # | Since: template-haskell-2.22.1.0 |
Defined in GHC.Internal.TH.Lift Methods lift :: Quote m => TypeFamilyHead -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => TypeFamilyHead -> Code m TypeFamilyHead # | |
| Lift Word16 # | |
| Lift Word32 # | |
| Lift Word64 # | |
| Lift Word8 # | |
| Lift Integer # | |
| Lift Natural # | |
| Lift () # | |
| Lift Bool # | |
| Lift Char # | |
| Lift Double # | |
| Lift Float # | |
| Lift Int # | |
| Lift Word # | |
| Lift Char# # | Since: template-haskell-2.16.0.0 |
| Lift Word# # | Since: template-haskell-2.16.0.0 |
| Lift (# #) # | Since: template-haskell-2.16.0.0 |
| Lift a => Lift (NonEmpty a :: Type) # | Since: template-haskell-2.15.0.0 |
| Integral a => Lift (Ratio a :: Type) # | |
| Lift a => Lift (TyVarBndr a :: Type) # | Since: template-haskell-2.22.1.0 |
| Lift a => Lift (Maybe a :: Type) # | |
| Lift a => Lift ([a] :: Type) # | |
| (Lift a, Lift b) => Lift (Either a b :: Type) # | |
| Lift (TExp a :: Type) # | Since: template-haskell-2.22.1.0 |
| (Lift a, Lift b) => Lift ((a, b) :: Type) # | |
| (Lift a, Lift b, Lift c) => Lift ((a, b, c) :: Type) # | |
| (Lift a, Lift b, Lift c, Lift d) => Lift ((a, b, c, d) :: Type) # | |
| (Lift a, Lift b, Lift c, Lift d, Lift e) => Lift ((a, b, c, d, e) :: Type) # | |
| (Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift ((a, b, c, d, e, f) :: Type) # | |
| (Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift ((a, b, c, d, e, f, g) :: Type) # | |
Wired-in names
liftString :: Quote m => String -> m Exp #