Fix the build with GHC < 6.4 (foldl1' didn't exist)
authorIan Lynagh <igloo@earth.li>
Sat, 27 Oct 2007 21:05:26 +0000 (21:05 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 27 Oct 2007 21:05:26 +0000 (21:05 +0000)
compiler/utils/Util.lhs

index 6cefad6..eb8595d 100644 (file)
@@ -14,6 +14,8 @@
 
 module Util (
 
+    foldl1',
+
        -- general list processing
        zipEqual, zipWithEqual, zipWith3Equal, zipWith4Equal,
         zipLazy, stretchZipWith,
@@ -117,6 +119,15 @@ import System.Time ( ClockTime )
 infixr 9 `thenCmp`
 \end{code}
 
+\begin{code}
+#if __GLASGOW_HASKELL__ < 603
+-- foldl1' was introduce in GHC 6.4
+foldl1'                  :: (a -> a -> a) -> [a] -> a
+foldl1' f (x:xs)         =  foldl' f x xs
+foldl1' _ []             =  errorEmptyList "foldl1'"
+#endif
+\end{code}
+
 %************************************************************************
 %*                                                                     *
 \subsection{A for loop}