#2132: Optimise nested comparisons
---------------------------------+------------------------------------------
    Reporter:  simonpj           |        Owner:  simonpj                
        Type:  bug               |       Status:  patch                  
    Priority:  low               |    Milestone:  7.4.1                  
   Component:  Compiler          |      Version:  6.8.2                  
    Keywords:                    |     Testcase:                         
   Blockedby:                    |   Difficulty:  Unknown                
          Os:  Unknown/Multiple  |     Blocking:                         
Architecture:  Unknown/Multiple  |      Failure:  Runtime performance bug
---------------------------------+------------------------------------------
Changes (by basvandijk):

 * cc: v.dijk.bas@… (added)


Comment:

 Would it be hard to extend the language of RULES so that a user can
 perform this optimization instead of the compiler? I'm thinking about
 something like this:

 {{{
 {-# RULES
 forall x y t f.
   (case (x ># y) of
      True  -> t
      False -> f
   )
   =
   (case (x ># y) of
      True  -> t {{(x ==# y)=False}}
      False -> f
   )
   #-}
 }}}

 The `v {{subrules}}` syntax assigns ''sub-RULES'' to the variable `v`.
 `subrules` is a list of RULES of the form `p1 = e1, p2 = e2 ... pn = en`
 which are applied to the expression that `v` refers to.

 I think it would be nice if sub-RULES have the same (or a very similar)
 syntax that normal RULES have. They should even be able to quantify new
 variables.

 The way I expect this to be used most often is that the sub-RULES describe
 the actual substitutions while the ''top-level'' RULE only describes
 context. However it should be possible that both the top-level and the
 sub-rules describe transformations.

 This probably deserves its own ticket so I stop now.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to