[project @ 2004-02-05 11:58:21 by malcolm]
authormalcolm <unknown>
Thu, 5 Feb 2004 11:58:21 +0000 (11:58 +0000)
committermalcolm <unknown>
Thu, 5 Feb 2004 11:58:21 +0000 (11:58 +0000)
Fix definition of 'partition' to match the (non-)strictness mandated by
the Haskell'98 Libraries Report version.

Data/List.hs

index 48b1ae1..5b8d767 100644 (file)
@@ -404,8 +404,8 @@ partition           :: (a -> Bool) -> [a] -> ([a],[a])
 {-# INLINE partition #-}
 partition p xs = foldr (select p) ([],[]) xs
 
-select p x (ts,fs) | p x       = (x:ts,fs)
-                   | otherwise = (ts, x:fs)
+select p x ~(ts,fs) | p x       = (x:ts,fs)
+                    | otherwise = (ts, x:fs)
 
 -- | The 'mapAccumL' function behaves like a combination of 'map' and
 -- 'foldl'; it applies a function to each element of a list, passing