th-lift-0.8.6: Derive Template Haskell's Lift class for datatypes.

Safe Haskell | None
Language | Haskell2010

Language.Haskell.TH.Lift

Contents

- Orphan instances

Synopsis

- deriveLift :: Name -> Q [Dec]
- deriveLiftMany :: [Name] -> Q [Dec]
- deriveLift' :: [Role] -> Info -> Q [Dec]
- deriveLiftMany' :: [([Role], Info)] -> Q [Dec]
- makeLift :: Name -> Q Exp
- makeLift' :: Info -> Q Exp
- class Lift (t :: TYPE r) where
  - lift :: Quote m => t -> m Exp
  - liftTyped :: forall (m :: Type -> Type). Quote m => t -> Code m t

# Documentation

deriveLift :: Name -> Q [Dec] Source #

deriveLiftMany :: [Name] -> Q [Dec] Source #

Derive `Lift` instances for many datatypes.

deriveLift' :: [Role] -> Info -> Q [Dec] Source #

Obtain `Info` values through a custom reification function. This is useful when generating instances for datatypes that have not yet been declared.

deriveLiftMany' :: [([Role], Info)] -> Q [Dec] Source #

makeLift :: Name -> Q Exp Source #

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.

makeLift' :: Info -> Q Exp Source #

Like `makeLift`, but using a custom reification function.

class Lift (t :: TYPE r) where #

Minimal complete definition

liftTyped

Methods

lift :: Quote m => t -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => t -> Code m t #

#### Instances

Instances details

Lift Addr# |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Addr# -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Addr# -> Code m Addr# #
Lift Double# |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Double# -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Double# -> Code m Double# #
Lift Float# |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Float# -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Float# -> Code m Float# #
Lift Int# |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Int# -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Int# -> Code m Int# #
Lift ByteArray |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => ByteArray -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ByteArray -> Code m ByteArray #
Lift Void |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Void -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Void -> Code m Void #
Lift Int16 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Int16 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Int16 -> Code m Int16 #
Lift Int32 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Int32 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Int32 -> Code m Int32 #
Lift Int64 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Int64 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Int64 -> Code m Int64 #
Lift Int8 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Int8 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Int8 -> Code m Int8 #
Lift Word16 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Word16 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Word16 -> Code m Word16 #
Lift Word32 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Word32 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Word32 -> Code m Word32 #
Lift Word64 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Word64 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Word64 -> Code m Word64 #
Lift Word8 |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Word8 -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Word8 -> Code m Word8 #
Lift ModName Source # |
Instance details Defined in Language.Haskell.TH.Lift Methods lift :: Quote m => ModName -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ModName -> Code m ModName #
Lift Name Source # |
Instance details Defined in Language.Haskell.TH.Lift Methods lift :: Quote m => Name -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Name -> Code m Name #
Lift NameFlavour Source # |
Instance details Defined in Language.Haskell.TH.Lift Methods lift :: Quote m => NameFlavour -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NameFlavour -> Code m NameFlavour #
Lift NameSpace Source # |
Instance details Defined in Language.Haskell.TH.Lift Methods lift :: Quote m => NameSpace -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NameSpace -> Code m NameSpace #
Lift OccName Source # |
Instance details Defined in Language.Haskell.TH.Lift Methods lift :: Quote m => OccName -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => OccName -> Code m OccName #
Lift PkgName Source # |
Instance details Defined in Language.Haskell.TH.Lift Methods lift :: Quote m => PkgName -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => PkgName -> Code m PkgName #
Lift Integer |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Integer -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Integer -> Code m Integer #
Lift Natural |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Natural -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Natural -> Code m Natural #
Lift () |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => () -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => () -> Code m () #
Lift Bool |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Bool -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Bool -> Code m Bool #
Lift Char |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Char -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Char -> Code m Char #
Lift Double |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Double -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Double -> Code m Double #
Lift Float |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Float -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Float -> Code m Float #
Lift Int |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Int -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Int -> Code m Int #
Lift Word |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Word -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Word -> Code m Word #
Lift Char# |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Char# -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Char# -> Code m Char# #
Lift Word# |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Word# -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Word# -> Code m Word# #
Lift (# #) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# #) -> Code m (# #) #
Lift a => Lift (NonEmpty a :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => NonEmpty a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NonEmpty a -> Code m (NonEmpty a) #
Integral a => Lift (Ratio a :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Ratio a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Ratio a -> Code m (Ratio a) #
Lift a => Lift (Maybe a :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Maybe a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Maybe a -> Code m (Maybe a) #
Lift a => Lift ([a] :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => [a] -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => [a] -> Code m [a] #
Lift (Fixed a :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Fixed a -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Fixed a -> Code m (Fixed a) #
(Lift a, Lift b) => Lift (Either a b :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => Either a b -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Either a b -> Code m (Either a b) #
(Lift a, Lift b) => Lift ((a, b) :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (a, b) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (a, b) -> Code m (a, b) #
(Lift a, Lift b, Lift c) => Lift ((a, b, c) :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (a, b, c) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (a, b, c) -> Code m (a, b, c) #
(Lift a, Lift b, Lift c, Lift d) => Lift ((a, b, c, d) :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (a, b, c, d) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (a, b, c, d) -> Code m (a, b, c, d) #
(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift ((a, b, c, d, e) :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (a, b, c, d, e) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (a, b, c, d, e) -> Code m (a, b, c, d, e) #
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift ((a, b, c, d, e, f) :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (a, b, c, d, e, f) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (a, b, c, d, e, f) -> Code m (a, b, c, d, e, f) #
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift ((a, b, c, d, e, f, g) :: Type) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (a, b, c, d, e, f, g) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (a, b, c, d, e, f, g) -> Code m (a, b, c, d, e, f, g) #
Lift a => Lift ((# a #) :: TYPE ('TupleRep '[LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a #) -> Code m (# a #) #
(Lift a, Lift b) => Lift ((# a | b #) :: TYPE ('SumRep '[LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a | b #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a | b #) -> Code m (# a | b #) #
(Lift a, Lift b) => Lift ((# a, b #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a, b #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a, b #) -> Code m (# a, b #) #
(Lift a, Lift b, Lift c) => Lift ((# a | b | c #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a | b | c #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a | b | c #) -> Code m (# a | b | c #) #
(Lift a, Lift b, Lift c) => Lift ((# a, b, c #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a, b, c #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a, b, c #) -> Code m (# a, b, c #) #
(Lift a, Lift b, Lift c, Lift d) => Lift ((# a | b | c | d #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a | b | c | d #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a | b | c | d #) -> Code m (# a | b | c | d #) #
(Lift a, Lift b, Lift c, Lift d) => Lift ((# a, b, c, d #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a, b, c, d #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a, b, c, d #) -> Code m (# a, b, c, d #) #
(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift ((# a | b | c | d | e #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a | b | c | d | e #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a | b | c | d | e #) -> Code m (# a | b | c | d | e #) #
(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift ((# a, b, c, d, e #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a, b, c, d, e #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a, b, c, d, e #) -> Code m (# a, b, c, d, e #) #
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift ((# a | b | c | d | e | f #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a | b | c | d | e | f #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a | b | c | d | e | f #) -> Code m (# a | b | c | d | e | f #) #
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift ((# a, b, c, d, e, f #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a, b, c, d, e, f #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a, b, c, d, e, f #) -> Code m (# a, b, c, d, e, f #) #
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift ((# a | b | c | d | e | f | g #) :: TYPE ('SumRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a | b | c | d | e | f | g #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a | b | c | d | e | f | g #) -> Code m (# a | b | c | d | e | f | g #) #
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f, Lift g) => Lift ((# a, b, c, d, e, f, g #) :: TYPE ('TupleRep '[LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep, LiftedRep])) |
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => (# a, b, c, d, e, f, g #) -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => (# a, b, c, d, e, f, g #) -> Code m (# a, b, c, d, e, f, g #) #

# Orphan instances

Lift ModName Source # |
Instance details Methods lift :: Quote m => ModName -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => ModName -> Code m ModName #
Lift Name Source # |
Instance details Methods lift :: Quote m => Name -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Name -> Code m Name #
Lift NameFlavour Source # |
Instance details Methods lift :: Quote m => NameFlavour -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NameFlavour -> Code m NameFlavour #
Lift NameSpace Source # |
Instance details Methods lift :: Quote m => NameSpace -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NameSpace -> Code m NameSpace #
Lift OccName Source # |
Instance details Methods lift :: Quote m => OccName -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => OccName -> Code m OccName #
Lift PkgName Source # |
Instance details Methods lift :: Quote m => PkgName -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => PkgName -> Code m PkgName #