| Copyright | (c) Ian Lynagh, 2006, (c) SAM Group, KTH/ICT/ECS 2007-2008 |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | forsyde-dev@ict.kth.se |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell98 |
Language.Haskell.TH.Lift
Contents
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
- 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 Dec Source #
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])