[Template-haskell] RE: TH2 bug

Ian Lynagh igloo at earth.li
Wed Nov 3 09:05:43 EST 2004


On Wed, Oct 27, 2004 at 02:19:57PM +0100, Simon Peyton-Jones wrote:
> 
> And what questions do you want to be able to ask of the value in the
> Info?  For example would it be enough to day
> 
>   data Info = TyConI Dec
> 	| PrimTyCon
> 	| ClassI Dec
> 	...etc...
> 
> where the PrimTyCon is returned for (->), Int#, etc?

Being able to tell whether it is a lifted type or not might be useful,
so you know not to go making class instances of Int#. Also it may be
useful to know that (->) takes 2 types as arguments. Maybe

    PrimTyCon Bool{-unlifted-} Name [Name]

(i.e. DataD with all the stuff that doesn't occur removed)? In fact, we
could just have (DataD [] name names [] []), but I think I prefer the
above as it makes it clear you can't tweak it a bit and splice it in
(and gives a place to say "unlifted").


Incidentally, ghci seems to be running the contents of splices twice:

Prelude Language.Haskell.TH> $( do runIO $ putStrLn "Foo"; return (LitE (IntegerL 5)) )
Foo
Foo
5
Prelude Language.Haskell.TH> 


Thanks
Ian



More information about the template-haskell mailing list