summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-10-05 20:40:44 +0000
committerIan Lynagh <igloo@earth.li>2009-10-05 20:40:44 +0000
commit3b03f47bbeb96c12351ebd11f6565e1f8cec4241 (patch)
tree3afed5eab78fdf485d57d98d9af11fc3fbe819f7
parent8066838aa14adf2371f6e1745424c3b6baa6d164 (diff)
downloadhaskell-3b03f47bbeb96c12351ebd11f6565e1f8cec4241.tar.gz
Use the standard library versions of elem and notElem
rather than our own copies
-rw-r--r--compiler/utils/Util.lhs33
1 files changed, 12 insertions, 21 deletions
diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs
index d8b61f898d..16a1628d35 100644
--- a/compiler/utils/Util.lhs
+++ b/compiler/utils/Util.lhs
@@ -386,36 +386,27 @@ Debugging/specialising versions of \tr{elem} and \tr{notElem}
isIn, isn'tIn :: Eq a => String -> a -> [a] -> Bool
# ifndef DEBUG
-isIn _msg x ys = elem__ x ys
-isn'tIn _msg x ys = notElem__ x ys
-
---these are here to be SPECIALIZEd (automagically)
-elem__ :: Eq a => a -> [a] -> Bool
-elem__ _ [] = False
-elem__ x (y:ys) = x == y || elem__ x ys
-
-notElem__ :: Eq a => a -> [a] -> Bool
-notElem__ _ [] = True
-notElem__ x (y:ys) = x /= y && notElem__ x ys
+isIn _msg x ys = x `elem` ys
+isn'tIn _msg x ys = x `notElem` ys
# else /* DEBUG */
isIn msg x ys
- = elem (_ILIT(0)) x ys
+ = elem100 (_ILIT(0)) x ys
where
- elem _ _ [] = False
- elem i x (y:ys)
+ elem100 _ _ [] = False
+ elem100 i x (y:ys)
| i ># _ILIT(100) = trace ("Over-long elem in " ++ msg)
- (x `List.elem` (y:ys))
- | otherwise = x == y || elem (i +# _ILIT(1)) x ys
+ (x `elem` (y:ys))
+ | otherwise = x == y || elem100 (i +# _ILIT(1)) x ys
isn'tIn msg x ys
- = notElem (_ILIT(0)) x ys
+ = notElem100 (_ILIT(0)) x ys
where
- notElem _ _ [] = True
- notElem i x (y:ys)
+ notElem100 _ _ [] = True
+ notElem100 i x (y:ys)
| i ># _ILIT(100) = trace ("Over-long notElem in " ++ msg)
- (x `List.notElem` (y:ys))
- | otherwise = x /= y && notElem (i +# _ILIT(1)) x ys
+ (x `notElem` (y:ys))
+ | otherwise = x /= y && notElem100 (i +# _ILIT(1)) x ys
# endif /* DEBUG */
\end{code}