summaryrefslogtreecommitdiff
path: root/ghc/compiler/utils/Maybes.lhs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/compiler/utils/Maybes.lhs')
-rw-r--r--ghc/compiler/utils/Maybes.lhs9
1 files changed, 7 insertions, 2 deletions
diff --git a/ghc/compiler/utils/Maybes.lhs b/ghc/compiler/utils/Maybes.lhs
index 5ed4ac316f..1f17679019 100644
--- a/ghc/compiler/utils/Maybes.lhs
+++ b/ghc/compiler/utils/Maybes.lhs
@@ -13,7 +13,6 @@ module Maybes (
MaybeErr(..),
allMaybes,
- catMaybes,
firstJust,
expectJust,
maybeToBool,
@@ -28,7 +27,9 @@ module Maybes (
returnMaybe,
thenMaB
-#if ! defined(COMPILING_GHC)
+#if defined(COMPILING_GHC)
+ , catMaybes
+#else
, findJust
, foldlMaybeErrs
, listMaybeErrs
@@ -41,6 +42,8 @@ CHK_Ubiq() -- debugging consistency check
import Unique (Unique) -- only for specialising
+#else
+import Maybe -- renamer will tell us if there are any conflicts
#endif
\end{code}
@@ -63,10 +66,12 @@ a list of @Justs@ into a single @Just@, returning @Nothing@ if there
are any @Nothings@.
\begin{code}
+#ifdef COMPILING_GHC
catMaybes :: [Maybe a] -> [a]
catMaybes [] = []
catMaybes (Nothing : xs) = catMaybes xs
catMaybes (Just x : xs) = (x : catMaybes xs)
+#endif
allMaybes :: [Maybe a] -> Maybe [a]
allMaybes [] = Just []