FIX BUILD with ghc-6.4.x
authorSimon Marlow <simonmar@microsoft.com>
Fri, 1 Feb 2008 11:43:02 +0000 (11:43 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Fri, 1 Feb 2008 11:43:02 +0000 (11:43 +0000)
utils/ghc-pkg/Main.hs

index 6fa1e6b..936b309 100644 (file)
@@ -48,8 +48,13 @@ import System.Exit ( exitWith, ExitCode(..) )
 import System.Environment ( getArgs, getProgName, getEnv )
 import System.IO
 import System.IO.Error (try)
-import Data.List ( isPrefixOf, isSuffixOf, isInfixOf, intersperse, sortBy, nub,
+import Data.List ( isPrefixOf, isSuffixOf, intersperse, sortBy, nub,
                    unfoldr, break )
+#if __GLASGOW_HASKELL__ > 604
+import Data.List ( isInfixOf )
+#else
+import Data.List ( tails )
+#endif
 import Control.Concurrent
 
 #ifdef mingw32_HOST_OS
@@ -1063,3 +1068,8 @@ installSignalHandlers = do
 #else
   return () -- nothing
 #endif
+
+#if __GLASGOW_HASKELL__ <= 604
+isInfixOf               :: (Eq a) => [a] -> [a] -> Bool
+isInfixOf needle haystack = any (isPrefixOf needle) (tails haystack)
+#endif