TH_spliceDecl3_Lib.hs 341 Bytes
Newer Older
chak's avatar
chak committed
1 2 3
module TH_spliceDecl3_Lib
where

4
import Language.Haskell.TH
chak's avatar
chak committed
5 6

rename' :: Dec -> Q [Dec]
7
rename' (DataD ctxt tyName tyvars cons derivs) =
8
  return [DataD ctxt (stripMod tyName) tyvars (map renameCons cons) derivs]
chak's avatar
chak committed
9
  where
10
    renameCons (NormalC conName tys) = NormalC (stripMod conName) tys
chak's avatar
chak committed
11
    --
12
    stripMod v = mkName (nameBase v ++ "'")