[Template-haskell] Splicing in class declarations doesn't work

Simon Peyton-Jones simonpj@microsoft.com
Mon, 19 May 2003 16:11:44 +0100


Fixed, thank you.

Simon

| -----Original Message-----
| From: template-haskell-admin@haskell.org
[mailto:template-haskell-admin@haskell.org] On Behalf Of
| Andre Pang
| Sent: 17 May 2003 18:41
| To: template-haskell@haskell.org
| Subject: [Template-haskell] Splicing in class declarations doesn't
work
|=20
| Hallo all,
|=20
| 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:
|=20
|      spliceTest =3D [d| class Foo f where {} |]
|=20
| However, splicing in this code doesn't work:
|=20
|      spliceTestDeux =3D [d| class Bar b where { baz :: Int -> Int } |]
|=20
|      3:30 ~/th/newnew % ghci -fglasgow-exts -ddump-splices
| ObjCTypesTHTest.hs
|      ...
|      ObjCTypesTHTest.hs:1: Splicing declarations
| 	spliceTest =3D=3D=3D=3D=3D=3D> class Foo f'0
|      ObjCTypesTHTest.hs:1: Splicing declarations
| 	spliceTestDeux
|      =3D=3D=3D=3D=3D=3D>
| 	class Bar b'1 where { baz :: GHC.Base.Int -> GHC.Base.Int; }
|=20
|      Variable not in scope: `baz'
|=20
|      Misplaced type signature: baz :: Int -> Int
|      Failed, modules loaded: ObjCTypesTH.
|      *ObjCTypesTH>
|=20
| Splicing in a "raw" declaration:
|=20
|      spliceTestDeux :: Q [Dec]
|      spliceTestDeux =3D return
|      [ Class [] "Bar" ["b"] [Proto "baz" (tappsArr [intCon, intCon])]
]
|         where
| 	    intCon =3D Tcon (TconName "Int")
|=20
| doesn't work either (with exactly the same error message).
|=20
| (BTW, should I send TH-related bugs to template-haskell, put them in
| the bug tracker, or both?)
|=20
| Thanks again,
|=20
|=20
| --
| % Andre Pang : trust.in.love.to.savee
|=20
| _______________________________________________
| template-haskell mailing list
| template-haskell@haskell.org
| http://www.haskell.org/mailman/listinfo/template-haskell