optimization and rewrite rules questions

Simon Peyton-Jones simonpj at microsoft.com
Thu Feb 26 07:51:37 EST 2009


| II is where I'd like to be able to distinguish variables, constants,
| and complex expressions in the left-hand sides of RULES, and
| I and III are where I'd like control over the rewrite strategy, as
| in strategy combinators.

I'm deep in icfp submissions, so no time to reply properly.

You can distinguish between literals, variables etc, in GHC's BuiltinRules.  These are not hard to write: see prelude/PrelRules.  But they are built in, not part of the source program.  Maybe that's ok, since you are messing with built-in arithmetic.


Another avenue is to elaborate the language of rules somehow to let you say what you want. But I don't know a good *spec* for such a feature, let alone an impl.

Another possibility is to write a Core-to-Core optimiser aimed at your target area.  Max B's plugins would let you dynamically link that to a distributed GHC.  But it's not in the HEAD yet...

Simon


More information about the Glasgow-haskell-users mailing list