[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / compiler / utils / Maybes.lhs
index 49ab0c4..98efdb7 100644 (file)
@@ -1,11 +1,9 @@
 %
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
 %
 \section[Maybes]{The `Maybe' types and associated utility functions}
 
 \begin{code}
-#include "HsVersions.h"
-
 module Maybes (
 --     Maybe(..), -- no, it's in 1.3
        MaybeErr(..),
@@ -28,13 +26,9 @@ module Maybes (
        catMaybes
     ) where
 
-CHK_Ubiq()                     -- debugging consistency check
-import Unique  (Unique)                -- only for specialising
+#include "HsVersions.h"
 
-#if __GLASGOW_HASKELL__ >= 204
 import Maybe( catMaybes, mapMaybe )
-#endif
-
 \end{code}
 
 
@@ -63,19 +57,6 @@ allMaybes (Just x  : ms) = case (allMaybes ms) of
                             Nothing -> Nothing
                             Just xs -> Just (x:xs)
 
-#if __GLASGOW_HASKELL__ < 204
-       -- After 2.04 we get these from the library Maybe
-catMaybes :: [Maybe a] -> [a]
-catMaybes []               = []
-catMaybes (Nothing : xs)   = catMaybes xs
-catMaybes (Just x : xs)           = (x : catMaybes xs)
-
-mapMaybe :: (a -> Maybe b) -> [a] -> [b]
-mapMaybe f [] = []
-mapMaybe f (x:xs) = case f x of
-                       Just y  -> y : mapMaybe f xs
-                       Nothing -> mapMaybe f xs
-#endif
 \end{code}
 
 @firstJust@ takes a list of @Maybes@ and returns the
@@ -131,12 +112,6 @@ assocMaybe alist key
   where
     lookup []            = Nothing
     lookup ((tv,ty):rest) = if key == tv then Just ty else lookup rest
-
-{-# SPECIALIZE assocMaybe
-       :: [(FAST_STRING,   b)] -> FAST_STRING -> Maybe b
-        , [(Int,           b)] -> Int         -> Maybe b
-        , [(Unique,        b)] -> Unique      -> Maybe b
-  #-}
 \end{code}
 
 @mkLookupFun eq alist@ is a function which looks up