[Haskell-cafe] Re: How to make cabal pass flags to happy?

Niklas Broberg niklas.broberg at gmail.com
Wed Oct 20 04:37:29 EDT 2010


Thanks for the answers, all. :-)

Since this doesn't seem to be the common knowledge I expected it to
be, I'll try to work out how it's done properly and blog about it. And
hopefully generate some much needed documentation for cabal along the
way.

>> >> What I want specifically is to have happy produce a GLR parser from my
>> >> .ly file, and I want this to happen during 'cabal install'. Which in
>> >> turn means I want cabal to pass the "--glr" flag to happy during
>> >> setup. My best guess is that I might want to use 'ppHappy' [1], or
>> >> something in the vicinity, but there's no documentation for the
>> >> combinator and it's far from obvious how to pass arguments to it.
>
> I think the "right solution" is for the happy source file to specify
> what kind of grammar it is / should be produced. Yes, that would mean
> modifying happy.

Hmm, I agree with you in this particular case, regarding the grammar,
since it really only makes sense for any given happy grammar to
generate either kind of parser. But such a solution still wouldn't
answer the general question about passing flags to preprocessors.
Certainly not all such use cases are best fixed by pushing the flags
into the pre-processed files.

Cheers,

/Niklas


More information about the Haskell-Cafe mailing list