ForSyDe-3.1.1: ForSyDe's Haskell-embedded Domain Specific Language.

Portabilityportable
Stabilityexperimental
Maintainerforsyde-dev@ict.kth.se

Language.Haskell.TH.Lift

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/cgi-bin/hackage-scripts/package/th-lift

Synopsis

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])