Confusing flags for RULES in GHC

Simon Peyton-Jones simonpj at
Mon Aug 11 08:14:47 EDT 2008


The use of flags to control rewrite rules in GHC is very confusing.  Several bug reports arise from this.  There is a summary here:

The final comment is a proposal, which I append below.  This email is just to allow others to comment on the proposed change.  It's all minor and tiresome, but I don't want to change it and then find it's still awkward.

NB: please read the whole ticket if you want to comment on these proposals.  And add your comments to the ticket.


    * Do not add -XRewriteRules. A RULE is in a pragma, and so is silently ignored by other compilers anyway. Other pragmas like SPECIALISE do not have a language extension flag. They will generate errors if they are plain wrong (e.g. variables out of scope). But adding a language flag would be inconsistent.

    * Inside a RULE, switch on the forall-as-keyword in the lexer, unconditionally. Simon M will do this, and send a patch to Simon PJ for validation.

    * Merge the -XScopedTypeVariables and -XPatternSignatures flags. Distinguishing them isn't senseless, but it's jolly confusing.

    * Inside a RULE, switch on -XScopedTypeVariables unconditionally.

    * Change -frewrite-rules to -fuse-rewrite-rules; deprecate the former.

More information about the Glasgow-haskell-users mailing list