#7162: RULES that never fire (automatically)
---------------------------------+------------------------------------------
    Reporter:  andygill          |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.4.2           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * difficulty:  => Unknown


Old description:

> 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, 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 happy making the required changes.

New description:

 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.

--

Comment:

 I think I'm ok with this.  All the machinery is there already except for
 the concrete syntax to say "never execute".

 The only question in my mind is whether to be a bit more explicit by
 saying
 {{{
   {-# RULES [NEVER] "map/map" ... #-}
 }}}
 but that means more work in the lexer, so it probably isn't worth it. I
 don't feel strongly.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7162#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to