From 531a43d6aa7230c737575e913f3d9c831bf42fbf Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 27 Oct 2007 21:05:26 +0000 Subject: [PATCH] Fix the build with GHC < 6.4 (foldl1' didn't exist) --- compiler/utils/Util.lhs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 6cefad6..eb8595d 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -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} -- 1.7.10.4