summaryrefslogtreecommitdiff
path: root/compiler/utils/Util.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2017-03-12 15:15:05 -0400
committerBen Gamari <ben@smart-cactus.org>2017-03-13 13:53:35 -0400
commit9297c6f3177f549f230cac33a79ec0dc9d8bee70 (patch)
treef877456bc80796fa1b3fbe4fd511928ee7046900 /compiler/utils/Util.hs
parent2f2622c601136a62e465dcd3b3b02db8156734b6 (diff)
downloadhaskell-9297c6f3177f549f230cac33a79ec0dc9d8bee70.tar.gz
Replace debugging trace with a proper WARN
Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3326
Diffstat (limited to 'compiler/utils/Util.hs')
-rw-r--r--compiler/utils/Util.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs
index 5c09959f6d..30026c5016 100644
--- a/compiler/utils/Util.hs
+++ b/compiler/utils/Util.hs
@@ -164,6 +164,10 @@ import qualified Data.Set as Set
import Data.Time
+#ifdef DEBUG
+import {-# SOURCE #-} Outputable ( warnPprTrace, text )
+#endif
+
infixr 9 `thenCmp`
{-
@@ -558,7 +562,7 @@ isIn msg x ys
elem100 :: Eq a => Int -> a -> [a] -> Bool
elem100 _ _ [] = False
elem100 i x (y:ys)
- | i > 100 = trace ("Over-long elem in " ++ msg) (x `elem` (y:ys))
+ | i > 100 = WARN(True, text ("Over-long elem in " ++ msg)) (x `elem` (y:ys))
| otherwise = x == y || elem100 (i + 1) x ys
isn'tIn msg x ys
@@ -567,7 +571,7 @@ isn'tIn msg x ys
notElem100 :: Eq a => Int -> a -> [a] -> Bool
notElem100 _ _ [] = True
notElem100 i x (y:ys)
- | i > 100 = trace ("Over-long notElem in " ++ msg) (x `notElem` (y:ys))
+ | i > 100 = WARN(True, text ("Over-long notElem in " ++ msg)) (x `notElem` (y:ys))
| otherwise = x /= y && notElem100 (i + 1) x ys
# endif /* DEBUG */