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

Safe HaskellNone
LanguageHaskell98

Language.Haskell.TH.Lift

Synopsis

Documentation

deriveLift :: Name -> Q [Dec]

Derive Lift instances for the given datatype.

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

Derive Lift instances for many datatypes.

deriveLift' :: Info -> Q [Dec]

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

makeLift :: Name -> Q Exp

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)

makeLift' :: Info -> Q Exp

Like makeLift, but using a custom reification function.

class Lift t where

Methods

lift :: t -> Q Exp

Instances

Lift Bool 
Lift Char 
Lift Double 
Lift Float 
Lift Int 
Lift Int8 
Lift Int16 
Lift Int32 
Lift Int64 
Lift Integer 
Lift Word 
Lift Word8 
Lift Word16 
Lift Word32 
Lift Word64 
Lift () 
Lift Natural 
Lift a => Lift [a] 
Integral a => Lift (Ratio a) 
Lift a => Lift (Maybe a) 
(Lift a, Lift b) => Lift (Either a b) 
(Lift a, Lift b) => Lift (a, b) 
(Lift a, Lift b, Lift c) => Lift (a, b, c) 
(Lift a, Lift b, Lift c, Lift d) => Lift (a, b, c, d) 
(Lift a, Lift b, Lift c, Lift d, Lift e) => Lift (a, b, c, d, e) 
(Lift a, Lift b, Lift c, Lift d, Lift e, Lift f) => Lift (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)