X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Futils%2FMaybes.lhs;h=98efdb7fa13446a439185766d7d8231f317e35f4;hb=438596897ebbe25a07e1c82085cfbc5bdb00f09e;hp=3cf3221ee6411727e5199f496c183ee440f84e0c;hpb=2a1807721fdd215bfa03dc1c199c374bc7a3e67e;p=ghc-hetmet.git diff --git a/ghc/compiler/utils/Maybes.lhs b/ghc/compiler/utils/Maybes.lhs index 3cf3221..98efdb7 100644 --- a/ghc/compiler/utils/Maybes.lhs +++ b/ghc/compiler/utils/Maybes.lhs @@ -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,10 +26,9 @@ module Maybes ( catMaybes ) where -#if __GLASGOW_HASKELL__ >= 204 -import Maybe( catMaybes, mapMaybe ) -#endif +#include "HsVersions.h" +import Maybe( catMaybes, mapMaybe ) \end{code} @@ -60,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