Skip to content

RULES that never fire (automatically)

We want a way of having GHC RULES known by GHC, but not used by the optimizer.

HERMIT, a interactive plugin for GHC that applies rules - and as well as built in rules (like alpha conversion, beta-reduction, etc) - also provide access to the named GHC RULES. Here is the rub: We want to use GHC RULES that are parsed and typed checked like normal rules, are visible to the HERMIT system, but never run by the simplifier. Currently we can say

  • attempt this before this (opt) pass, or
  • attempt after this pass, but there is no way of saying
  • never attempt.

We were thinking

    {-# RULES [~] "map/map" forall f g . map f (map g xs) = map (f.g) xs #-}

Where the [~] says *never* execute this without be explicitly asked, following on from the [~0] which does not run in first pass.

We are happy making the required changes.

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information