Commit ad6c2e39 authored by chak's avatar chak

[project @ 2002-11-21 13:25:13 by chak]

Renaming function for the reify/splice test needs to be in a separate module
parent bf178098
......@@ -4,14 +4,8 @@ module TH_spliceDecl3
where
import Language.Haskell.THSyntax
import TH_spliceDecl3_Lib
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
$(do {d <- reifyDecl T; rename' d})
module TH_spliceDecl3_Lib
where
import Language.Haskell.THSyntax
rename' :: Dec -> Q [Dec]
rename' (Data tyName tyvars cons derivs) =
return [Data (stripMod tyName ++ "'") tyvars (map renameCons cons) derivs]
where
renameCons (Constr conName tys) = Constr (stripMod conName ++ "'") tys
--
stripMod = tail . snd . break (== ':')
......@@ -16,4 +16,4 @@ test('TH_reifyType2', normal, compile, [''])
test('TH_spliceDecl1', normal, compile, [''])
test('TH_spliceDecl2', normal, compile, [''])
test('TH_spliceDecl3', normal, compile, [''])
test('TH_spliceDecl3', normal, multimod_compile, ['TH_spliceDecl3', '-v0'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment