Commit 686d64b4 authored by chak's avatar chak
Browse files

[project @ 2002-11-20 12:34:43 by chak]

- We are forcing importing THSyntax.Q at every top splice now; this suffices
  to get simple splices that do not involve reifyDecl or declaration
  quasi-quotes to work.  NB: This worked already when the construction of the
  Dec term and the splice were in separated modules, but not when they are in
  the same (see the regression test "TH_spliceDecl1.hs").
- The tests "TH_spliceDecl2.hs" and "TH_spliceDecl3.hs" use toplevel splices
  together with quasi-quoted and reifyDecl.  These currently still fail, as
  importing of some of the required type constructors from THSyntax isn't
parent 946d0b0d
-- test splicing of a generated data declarations
module TH_spliceDecl1
import Language.Haskell.THSyntax
-- splice a simple data declaration
$(return [Data "T" [] [Constr "C" []] []])
-- test splicing of a quoted data declarations
module TH_spliceDecl2
import Language.Haskell.THSyntax
-- splice a simple quoted declaration
$([d| data T = C |])
-- test splicing of reified and renamed data declarations
module TH_spliceDecl3
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
renameCons (Constr conName tys) = Constr (conName ++ "'") tys
......@@ -13,3 +13,7 @@ test('TH_reifyDecl4', normal, compile, [''])
test('TH_reifyType1', normal, compile, [''])
test('TH_reifyType2', normal, compile, [''])
test('TH_spliceDecl1', normal, compile, [''])
test('TH_spliceDecl2', normal, compile, [''])
test('TH_spliceDecl3', normal, compile, [''])
Supports Markdown
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