diff options
Diffstat (limited to 'compiler/utils/Util.hs')
-rw-r--r-- | compiler/utils/Util.hs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index 96e911ee44..e9b9d3f3df 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -114,9 +114,7 @@ import Data.IORef ( IORef, newIORef, atomicModifyIORef' ) import System.IO.Unsafe ( unsafePerformIO ) import Data.List hiding (group) -#ifdef DEBUG -import FastTypes -#endif +import GHC.Exts #if __GLASGOW_HASKELL__ < 709 import Control.Applicative (Applicative) @@ -465,22 +463,22 @@ isn'tIn _msg x ys = x `notElem` ys # else /* DEBUG */ isIn msg x ys - = elem100 (_ILIT(0)) x ys + = elem100 0 x ys where - elem100 _ _ [] = False + elem100 :: Eq a => Int -> a -> [a] -> Bool + elem100 _ _ [] = False elem100 i x (y:ys) - | i ># _ILIT(100) = trace ("Over-long elem in " ++ msg) - (x `elem` (y:ys)) - | otherwise = x == y || elem100 (i +# _ILIT(1)) x ys + | i > 100 = trace ("Over-long elem in " ++ msg) (x `elem` (y:ys)) + | otherwise = x == y || elem100 (i + 1) x ys isn'tIn msg x ys - = notElem100 (_ILIT(0)) x ys + = notElem100 0 x ys where + notElem100 :: Eq a => Int -> a -> [a] -> Bool notElem100 _ _ [] = True notElem100 i x (y:ys) - | i ># _ILIT(100) = trace ("Over-long notElem in " ++ msg) - (x `notElem` (y:ys)) - | otherwise = x /= y && notElem100 (i +# _ILIT(1)) x ys + | i > 100 = trace ("Over-long notElem in " ++ msg) (x `notElem` (y:ys)) + | otherwise = x /= y && notElem100 (i + 1) x ys # endif /* DEBUG */ {- @@ -491,9 +489,6 @@ isn'tIn msg x ys ************************************************************************ -} -sortWith :: Ord b => (a->b) -> [a] -> [a] -sortWith get_key xs = sortBy (comparing get_key) xs - minWith :: Ord b => (a -> b) -> [a] -> a minWith get_key xs = ASSERT( not (null xs) ) head (sortWith get_key xs) |