[Haskell-cafe] evaluating CAFs at compile time

adam vogt vogt.adam at gmail.com
Sun Jan 19 00:56:55 UTC 2014

On Sat, Jan 18, 2014 at 7:14 PM, Evan Laforge <qdunkan at gmail.com> wrote:
> However, if I understand Lift correctly (and not really understanding
> much of TH), you need to create instances for every type you wish to
> generate, which seems like it would be a pain.  Even if they can be
> automatically derived, it would spread TH dependency gunk throughout
> the whole program.  Is this true?  Is there a library that does the
> equivalent of a "eval at compile time" pragma? (Wren's proposed QAF
> library seems to have never made it to hackage, but maybe given Lift
> and the proper instances it turns out to be trivial.)  Would it be
> possible or desirable for an actual pragma that wouldn't introduce a
> TH dependency?

Hi Evan,

Check out <https://hackage.haskell.org/package/th-lift>. Also, there
is a of zeroTH here https://github.com/mgsloan/zeroth which works with
a haskell-src-exts < 1.14.

I'm not sure what benefit you'd get from a new mechanism (beside TH)
to calculate things at compile-time. Won't it have to solve the same
problems which are solved by TH already? How can those problems
(generating haskell code, stage restriction) be solved without ending
up with the same kind of complexity ("TH dependency gunk")?


More information about the Haskell-Cafe mailing list