summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_spliceDecl3_Lib.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/th/TH_spliceDecl3_Lib.hs')
-rw-r--r--testsuite/tests/th/TH_spliceDecl3_Lib.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_spliceDecl3_Lib.hs b/testsuite/tests/th/TH_spliceDecl3_Lib.hs
new file mode 100644
index 0000000000..1b8d44e781
--- /dev/null
+++ b/testsuite/tests/th/TH_spliceDecl3_Lib.hs
@@ -0,0 +1,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 ++ "'")