X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FUtil.lhs;h=bfb499a2c8ad020d45649b7d69749d324544b290;hb=f83010b119096699d1efef2f7bb45460719c48f9;hp=1d7f7a4ee211d07d366387753d3dab76ef84e383;hpb=262c142b90c94ca1aa577c950a6ceae1f255e2d6;p=ghc-hetmet.git diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 1d7f7a4..bfb499a 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -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}