[project @ 1996-07-25 20:43:49 by partain]
[ghc-hetmet.git] / ghc / compiler / utils / Maybes.lhs
index c40ffb2..1f17679 100644 (file)
@@ -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
@@ -39,6 +40,10 @@ module Maybes (
 
 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}
 
@@ -61,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 []
@@ -129,14 +136,11 @@ assocMaybe alist key
     lookup ((tv,ty):rest) = if key == tv then Just ty else lookup rest
 
 #if defined(COMPILING_GHC)
-{-? SPECIALIZE assocMaybe
-       :: [(String,        b)] -> String        -> Maybe b,
-          [(Id,            b)] -> Id            -> Maybe b,
-          [(Class,         b)] -> Class         -> Maybe b,
-          [(Int,           b)] -> Int           -> Maybe b,
-          [(Name,          b)] -> Name          -> Maybe b,
-          [(TyVar,         b)] -> TyVar         -> Maybe b,
-          [(TyVarTemplate, b)] -> TyVarTemplate -> Maybe b
+{-# SPECIALIZE assocMaybe
+       :: [(FAST_STRING,   b)] -> FAST_STRING -> Maybe b
+        , [(Int,           b)] -> Int         -> Maybe b
+        , [(Unique,        b)] -> Unique      -> Maybe b
+        , [(RdrName,       b)] -> RdrName     -> Maybe b
   #-}
 #endif
 \end{code}