[Haskell-cafe] Compile-time evaluation
alfonso.acosta at gmail.com
Sat Nov 3 11:26:35 EDT 2007
> 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
More information about the Haskell-Cafe