Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/f669426401c743d3e1ea2bba0ca92ac69ec79040

>---------------------------------------------------------------

commit f669426401c743d3e1ea2bba0ca92ac69ec79040
Author: Ian Lynagh <[email protected]>
Date:   Fri Jun 22 22:20:14 2012 +0100

    Use a derived Ord instance for Discr
    
    Our hand-written leAlt behaved differently when given a micture of
    constructors, but I think that either it won't make a difference or
    that this will be an improvement.

>---------------------------------------------------------------

 compiler/ghci/ByteCodeGen.lhs |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/compiler/ghci/ByteCodeGen.lhs b/compiler/ghci/ByteCodeGen.lhs
index 0587ed6..d722964 100644
--- a/compiler/ghci/ByteCodeGen.lhs
+++ b/compiler/ghci/ByteCodeGen.lhs
@@ -66,6 +66,7 @@ import Module
 import Data.Map (Map)
 import qualified Data.Map as Map
 import qualified FiniteMap as Map
+import Data.Ord
 
 -- 
-----------------------------------------------------------------------------
 -- Generating byte code for a complete module
@@ -1349,9 +1350,7 @@ mkMultiBranch maybe_ncons raw_ways = do
      return (instrs `appOL` the_default)
   where
          (defaults, not_defaults) = partition (isNoDiscr.fst) raw_ways
-         notd_ways = sortLe
-                        (\w1 w2 -> leAlt (fst w1) (fst w2))
-                        not_defaults
+         notd_ways = sortBy (comparing fst) not_defaults
 
          testLT (DiscrI i) fail_label = TESTLT_I i fail_label
          testLT (DiscrW i) fail_label = TESTLT_W i fail_label
@@ -1386,14 +1385,6 @@ mkMultiBranch maybe_ncons raw_ways = do
                  Just n  -> (0, fromIntegral n - 1)
                  Nothing -> (minBound, maxBound)
 
-         (DiscrI i1) `leAlt` (DiscrI i2) = i1 <= i2
-         (DiscrW w1) `leAlt` (DiscrW w2) = w1 <= w2
-         (DiscrF f1) `leAlt` (DiscrF f2) = f1 <= f2
-         (DiscrD d1) `leAlt` (DiscrD d2) = d1 <= d2
-         (DiscrP i1) `leAlt` (DiscrP i2) = i1 <= i2
-         NoDiscr     `leAlt` NoDiscr     = True
-         _           `leAlt` _           = False
-
          isNoDiscr NoDiscr = True
          isNoDiscr _       = False
 
@@ -1423,7 +1414,7 @@ data Discr
    | DiscrD Double
    | DiscrP Word16
    | NoDiscr
-    deriving Eq
+    deriving (Eq, Ord)
 
 instance Outputable Discr where
    ppr (DiscrI i) = int i



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to