Add a comment about when maybePrefixMatch can be removed
[ghc-hetmet.git] / compiler / utils / Util.lhs
index 1d7f7a4..495df82 100644 (file)
@@ -42,7 +42,7 @@ module Util (
        removeSpaces,
 
        -- strictness
-       foldl', seqList,
+       seqList,
 
        -- pairs
        unzipWith,
@@ -79,9 +79,12 @@ module Util (
 
 #include "HsVersions.h"
 
-import Panic           ( panic, trace )
 import FastTypes
 
+#ifdef DEBUG
+import Panic           ( panic, trace )
+#endif
+
 import Control.Exception ( Exception(..), finally, catchDyn, throw )
 import qualified Control.Exception as Exception
 import Data.Dynamic    ( Typeable )
@@ -89,10 +92,11 @@ import Data.IORef   ( IORef, newIORef )
 import System.IO.Unsafe        ( unsafePerformIO )
 import Data.IORef      ( readIORef, writeIORef )
 
-import qualified Data.List as List ( elem, notElem )
-
+import qualified Data.List as List ( elem )
 #ifndef DEBUG
 import Data.List               ( zipWith4 )
+#else
+import qualified Data.List as List ( notElem )
 #endif
 
 import Control.Monad   ( when )
@@ -487,16 +491,6 @@ transitiveClosure succ eq xs
 %*                                                                     *
 %************************************************************************
 
-A strict version of foldl.
-
-\begin{code}
-foldl'        :: (a -> b -> a) -> a -> [b] -> a
-foldl' f z xs = lgo z xs
-            where
-               lgo z []     =  z
-               lgo z (x:xs) = (lgo $! (f z x)) xs
-\end{code}
-
 A combination of foldl with zip.  It works with equal length lists.
 
 \begin{code}
@@ -596,6 +590,8 @@ cmpList cmp (a:as) (b:bs)
 \end{code}
 
 \begin{code}
+-- This (with a more general type) is Data.List.stripPrefix from GHC 6.8.
+-- This definition can be removed once we require at least 6.8 to build.
 maybePrefixMatch :: String -> String -> Maybe String
 maybePrefixMatch []    rest = Just rest
 maybePrefixMatch (_:_) []   = Nothing