Moduleth-lift-0.8.6Haskell2010
Language.Haskell.TH.Lift
- 1 class
- 6 values
- Packageth-lift-0.8.6
- Exports7
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceLift.hs
Derive Lift instances for many datatypes.
Obtain Info values through a custom reification function. This is useful when generating instances for datatypes that have not yet been declared.
Generates a lambda expresson which behaves like lift (without requiring a Lift instance). Example:
newtype Fix f = In { out :: f (Fix f) }
instance Lift (f (Fix f)) => Lift (Fix f) where
lift = $(makeLift ''Fix)
This can be useful when deriveLift is not clever enough to infer the correct instance context, such as in the example above.
Like makeLift, but using a custom reification function.
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.
Instances69Lift, …
Lift ByteArrayDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift IntSetDefined in containers-0.7 · Data.IntSet.InternalLift IntegerDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift NaturalDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift VoidDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Int16Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Int32Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Int64Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Int8Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Word16Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Word32Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Word64Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Word8Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Addr#Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxProduces an Addr# literal from the NUL-terminated C-string starting at the given memory address.
Lift Char#Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Double#Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Float#Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Int#Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift Word#Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift BoolDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift CharDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift DoubleDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift FloatDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift IntDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift WordDefined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift ModNameDefined in th-lift-0.8.6 · Language.Haskell.TH.Lift · orphanLift NameDefined in th-lift-0.8.6 · Language.Haskell.TH.Lift · orphanLift NameFlavourDefined in th-lift-0.8.6 · Language.Haskell.TH.Lift · orphanLift NameSpaceDefined in th-lift-0.8.6 · Language.Haskell.TH.Lift · orphanLift OccNameDefined in th-lift-0.8.6 · Language.Haskell.TH.Lift · orphanLift PkgNameDefined in th-lift-0.8.6 · Language.Haskell.TH.Lift · orphanLift ()Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift (# #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxIntegral a => Lift (Ratio a)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift a => Lift (IntMap a)Defined in containers-0.7 · Data.IntMap.InternalLift a => Lift (Digit a)Defined in containers-0.7 · Data.Sequence.InternalLift a => Lift (FingerTree a)Defined in containers-0.7 · Data.Sequence.InternalLift a => Lift (Node a)Defined in containers-0.7 · Data.Sequence.InternalLift a => Lift (Seq a)Defined in containers-0.7 · Data.Sequence.InternalLift a => Lift (ViewL a)Defined in containers-0.7 · Data.Sequence.InternalLift a => Lift (ViewR a)Defined in containers-0.7 · Data.Sequence.InternalLift a => Lift (Set a)Defined in containers-0.7 · Data.Set.InternalLift a => Lift (Tree a)Defined in containers-0.7 · Data.TreeLift a => Lift (NonEmpty a)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift a => Lift (Maybe a)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift a => Lift [a]Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift vertex => Lift (SCC vertex)Defined in containers-0.7 · Data.GraphLift (Fixed a)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b) => Lift (Either a b)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b) => Lift (a, b)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift k, Lift a) => Lift (Map k a)Defined in containers-0.7 · Data.Map.Internal(Lift a, Lift b, Lift c) => Lift (a, b, c)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d) => Lift (a, b, c, d)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift (a, b, c, d, e)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift (a, b, c, d, e, f)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift (a, b, c, d, e, f, g)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.SyntaxLift a => Lift (# a #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b) => Lift (# a, b #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b) => Lift (# a | b #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c) => Lift (# a, b, c #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c) => Lift (# a | b | c #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d) => Lift (# a, b, c, d #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d) => Lift (# a | b | c | d #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift (# a, b, c, d, e #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift (# a | b | c | d | e #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift (# a, b, c, d, e, f #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift (# a | b | c | d | e | f #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift (# a, b, c, d, e, f, g #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift (# a | b | c | d | e | f | g #)Defined in template-haskell-2.22.0.0 · Language.Haskell.TH.Syntax