summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_spliceDecl3_Lib.hs
blob: 1b8d44e7816170e57f355026504d2c6c7675dab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module TH_spliceDecl3_Lib
where

import Language.Haskell.TH

rename' :: Dec -> Q [Dec]
rename' (DataD ctxt tyName tyvars cons derivs) =
  return [DataD ctxt (stripMod tyName) tyvars (map renameCons cons) derivs]
  where
    renameCons (NormalC conName tys) = NormalC (stripMod conName) tys
    --
    stripMod v = mkName (nameBase v ++ "'")