
3 Nov
2007
3 Nov
'07
11:26 a.m.
Hi Nicholas,
compileTimeEval :: Data a => a -> ExpQ compileTimeEval = return . toExp
You're telling me all that horrendous pain in implementing toExp and it already exists?!?
Yes unfortunately, compileTimeEval already exists in TH, it's called lift compileTimeEval :: Lift a => a -> ExpQ compileTimeEval = lift But don't be so hard on yourself. Your approach has one advantage. GHC supports automatic derivation of Data whereas Lift instances have to be created manually. Note, however, that Lift instances can also be generated using Igloo's th-lift package[1]. Cheers, Fons [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/th-lift-0.2