TH_spliceDecl3.hs 356 Bytes
Newer Older
chak's avatar
chak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
-- test splicing of reified and renamed data declarations

module TH_spliceDecl3
where

import Language.Haskell.THSyntax

data T = C

$(rename (reifyDecl T))

rename :: Dec -> Q [Dec]
rename (Data tyName tyvars cons derivs) =
  Data (tyName ++ "'") tyvars (renameCons cons) derivs
  where
    renameCons (Constr conName tys) = Constr (conName ++ "'") tys