ForSyDe-3.0: ForSyDe's Haskell-embedded Domain Specific Language.Source codeContentsIndex
Language.Haskell.TH.Lift
Portabilityportable
Stabilityexperimental
Maintainerforsyde-dev@ict.kth.se
Description

Automatically derive Template Haskell's Lift class for datatypes using Template Haskell splices.

Based on Lynagh's th-lift package: http://hackage.haskell.org/package/th-lift

Synopsis
deriveLift1 :: Name -> Q [Dec]
deriveLift :: Name -> Q Dec
Documentation
deriveLift1 :: Name -> Q [Dec]Source

Automatically generate an instance of Lift for one data type. For example:

{-# LANGUAGE TemplateHaskell #-}
module Colour where
import Language.Haskell.TH.Lift

data RGB = Red | Green | Blue

-- Generate the Lift instance of RGB
$(deriveLift1 ''RGB)
deriveLift :: Name -> Q DecSource

Version of deriveLif1 used to automatically generate instances of Lift for multiple data types. For instance:

{-# LANGUAGE TemplateHaskell #-}
module Colour where
import Language.Haskell.TH.Lift

data RGB = Red | Green | Blue

data Num a => Pixel a = Pixel a a a

-- Generate Lift instances for RGB and Pixel
$(mapM deriveLift [''RGB, ''Pixel])
Produced by Haddock version 2.1.0