API Annotations, MINIMAL pragma and BooleanFormula

Alan & Kim Zimmerman alan.zimm at gmail.com
Fri Apr 10 09:30:21 UTC 2015


My last (known) issue is the MINIMAL pragma for a class definition.

In Parser.y this is captured (via `name_boolformula`) as a

  BooleanFormula (Located RdrName)

There is a problem with this from an API annotations point of view in that
the constructors (mkBool,mkAnd,mkOr) are smart and try to minimise the
boolean formula as it is constructed.

Unfortunately this discards information in the process.

I see a number of potential solutions

a. Capture the original source string for the pragma, and use that for the
annotations. This is a bad option.

b. Introduce a new variant of BooleanFormula for the AST, and convert to
use the current one when evaluating the pragma.

c. Keep the BooleanFormula as it is, but do not minimise the formula on
construction.

I suspect that c is the best option, I do not believe the formulas
constructed are particularly complex or numerous, so early optimisation is
not necessary.

Which is the best option? Or is there a different one?

Regards
  Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150410/db72da6b/attachment.html>


More information about the ghc-devs mailing list