[GHC] #3744: Comparisons against minBound/maxBound not optimised

GHC cvs-ghc at haskell.org
Mon Oct 25 09:05:48 EDT 2010


#3744: Comparisons against minBound/maxBound not optimised
---------------------------------+------------------------------------------
    Reporter:  rl                |        Owner:                         
        Type:  bug               |       Status:  new                    
    Priority:  normal            |    Milestone:  7.0.1                  
   Component:  Compiler          |      Version:  6.13                   
    Keywords:                    |     Testcase:                         
   Blockedby:                    |   Difficulty:                         
          Os:  Unknown/Multiple  |     Blocking:                         
Architecture:  Unknown/Multiple  |      Failure:  Runtime performance bug
---------------------------------+------------------------------------------
Changes (by daniel.is.fischer):

 * cc: daniel.is.fischer@… (added)


Comment:

 A global
 {{{
 {-# RULES
 "(<)/minBound"  forall x. x < minBound = False
 "(>)/minBound"  forall x. minBound > x = False
 etc.
   #-}
 }}}
 would eliminate those checks in many (almost all, hopefully) cases.
 However, it would break user code relying on incompatible Ord and Enum
 instances (it should not break local bindings for minBound/maxBound since
 the rule refers to GHC.Enum.minBound).

 Alternatively, one could add those rules for every pertinent type, but I'd
 prefer a more general solution.

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


More information about the Glasgow-haskell-bugs mailing list