
8 Jan
2009
8 Jan
'09
7:12 p.m.
wren ng thornton schrieb:
Every now and then I find myself in the position where I'd like to define some hairy value as a CAF instead of a literal, but I'd like for it to be fully evaluated at compile-time rather than postponed until runtime. It'd be possible to bludgeon the CPP into doing this, but it seems easier to use an autocannon like Template Haskell to swat this fly.
Is it really necessary to use CPP or TemplateHaskell for this kind of optimization? Can a pragma help? Maybe {-# INLINE #-} ?