[Template-haskell] Splicing in class declarations doesn't work
Andre Pang
ozone@algorithm.com.au
Sun, 18 May 2003 03:41:27 +1000
Hallo all,
I think I've found a bug with declaring classes, or more specifically,
declaring functions which instances of the classes are required to
implement. Splicing in the following code works fine:
spliceTest = [d| class Foo f where {} |]
However, splicing in this code doesn't work:
spliceTestDeux = [d| class Bar b where { baz :: Int -> Int } |]
3:30 ~/th/newnew % ghci -fglasgow-exts -ddump-splices
ObjCTypesTHTest.hs
...
ObjCTypesTHTest.hs:1: Splicing declarations
spliceTest ======> class Foo f'0
ObjCTypesTHTest.hs:1: Splicing declarations
spliceTestDeux
======>
class Bar b'1 where { baz :: GHC.Base.Int -> GHC.Base.Int; }
Variable not in scope: `baz'
Misplaced type signature: baz :: Int -> Int
Failed, modules loaded: ObjCTypesTH.
*ObjCTypesTH>
Splicing in a "raw" declaration:
spliceTestDeux :: Q [Dec]
spliceTestDeux = return
[ Class [] "Bar" ["b"] [Proto "baz" (tappsArr [intCon, intCon])] ]
where
intCon = Tcon (TconName "Int")
doesn't work either (with exactly the same error message).
(BTW, should I send TH-related bugs to template-haskell, put them in
the bug tracker, or both?)
Thanks again,
--
% Andre Pang : trust.in.love.to.savee