Remove mapAccumL, mapAccumR, mapAccumB
authorIan Lynagh <igloo@earth.li>
Mon, 2 Jul 2007 12:26:51 +0000 (12:26 +0000)
committerIan Lynagh <igloo@earth.li>
Mon, 2 Jul 2007 12:26:51 +0000 (12:26 +0000)
mapAccumL and mapAccumR are in Data.List now.
mapAccumB is unused.

17 files changed:
compiler/codeGen/CgClosure.lhs
compiler/codeGen/CgHeapery.lhs
compiler/codeGen/CgMonad.lhs
compiler/coreSyn/CoreSubst.lhs
compiler/coreSyn/CoreTidy.lhs
compiler/deSugar/DsArrows.lhs
compiler/iface/BinIface.hs
compiler/simplCore/CSE.lhs
compiler/simplCore/OccurAnal.lhs
compiler/simplCore/SimplEnv.lhs
compiler/specialise/Rules.lhs
compiler/stranal/DmdAnal.lhs
compiler/typecheck/Inst.lhs
compiler/typecheck/TcTyClsDecls.lhs
compiler/types/Type.lhs
compiler/utils/ListSetOps.lhs
compiler/utils/Util.lhs

index 98e5b0d..fabf434 100644 (file)
@@ -46,6 +46,8 @@ import BasicTypes
 import Constants
 import Outputable
 import FastString
+
+import Data.List
 \end{code}
 
 %********************************************************
index 4a12849..3bba211 100644 (file)
@@ -45,6 +45,8 @@ import Util
 import Constants
 import PackageConfig
 import Outputable
+
+import Data.List
 \end{code}
 
 
index 6885912..8723e46 100644 (file)
@@ -79,6 +79,7 @@ import FastString
 import Outputable
 
 import Control.Monad
+import Data.List
 
 infixr 9 `thenC`       -- Right-associative!
 infixr 9 `thenFC`
index 8306c04..1c81d88 100644 (file)
@@ -45,6 +45,8 @@ import Outputable
 import PprCore         ()              -- Instances
 import Util
 import FastTypes
+
+import Data.List
 \end{code}
 
 
index 95c3ac4..ea89fcc 100644 (file)
@@ -26,6 +26,8 @@ import OccName
 import SrcLoc
 import Maybes
 import Util
+
+import Data.List
 \end{code}
 
 
index fc2432d..c44ed59 100644 (file)
@@ -42,6 +42,8 @@ import Util
 import HsUtils
 import VarSet
 import SrcLoc
+
+import Data.List
 \end{code}
 
 \begin{code}
index 4664bf1..392873b 100644 (file)
@@ -34,6 +34,7 @@ import Config
 import FastMutInt
 import Outputable
 
+import Data.List
 import Data.Word
 import Data.Array
 import Data.IORef
index 39344fc..782e564 100644 (file)
@@ -21,8 +21,10 @@ import CoreLint              ( showPass, endPass )
 import Outputable
 import StaticFlags     ( opt_PprStyle_Debug )
 import BasicTypes      ( isAlwaysActive )
-import Util            ( mapAccumL, lengthExceeds )
+import Util            ( lengthExceeds )
 import UniqFM
+
+import Data.List
 \end{code}
 
 
index dc20fd2..ae2b7b9 100644 (file)
@@ -35,8 +35,10 @@ import Digraph               ( stronglyConnCompR, SCC(..) )
 import PrelNames       ( buildIdKey, foldrIdKey, runSTRepIdKey, augmentIdKey )
 import Unique          ( Unique )
 import UniqFM          ( keysUFM, intersectsUFM )  
-import Util            ( mapAndUnzip, mapAccumL )
+import Util            ( mapAndUnzip )
 import Outputable
+
+import Data.List
 \end{code}
 
 
index 1d7d2e4..6104d33 100644 (file)
@@ -58,6 +58,8 @@ import BasicTypes
 import DynFlags
 import Util
 import Outputable
+
+import Data.List
 \end{code}
 
 %************************************************************************
index ed9f238..26a499b 100644 (file)
@@ -45,7 +45,7 @@ import Maybes
 import OrdList
 import Bag
 import Util
-import List hiding( mapAccumL )        -- Also defined in Util
+import Data.List
 \end{code}
 
 
index 4c5de96..84c189e 100644 (file)
@@ -43,11 +43,13 @@ import UniqFM               ( plusUFM_C, addToUFM_Directly, lookupUFM_Directly,
 import Type            ( isUnLiftedType, coreEqType, splitTyConApp_maybe )
 import Coercion         ( coercionKind )
 import CoreLint                ( showPass, endPass )
-import Util            ( mapAndUnzip, mapAccumL, mapAccumR, lengthIs )
+import Util            ( mapAndUnzip, lengthIs )
 import BasicTypes      ( Arity, TopLevelFlag(..), isTopLevel, isNeverActive,
                          RecFlag(..), isRec )
 import Maybes          ( orElse, expectJust )
 import Outputable
+
+import Data.List
 \end{code}
 
 To think about
index 962e4e0..6a09244 100644 (file)
@@ -76,6 +76,8 @@ import DynFlags
 import Maybes
 import Util
 import Outputable
+
+import Data.List
 \end{code}
 
 
index 8a07fae..3d2e4ba 100644 (file)
@@ -44,7 +44,7 @@ import ListSetOps
 import Digraph
 import DynFlags
 
-import Data.List        ( partition, elemIndex )
+import Data.List
 import Control.Monad    ( mplus )
 \end{code}
 
index 37f915b..649baea 100644 (file)
@@ -122,6 +122,7 @@ import Util
 import Outputable
 import UniqSet
 
+import Data.List
 import Data.Maybe      ( isJust )
 \end{code}
 
index becf9e6..29f4bb1 100644 (file)
@@ -24,9 +24,9 @@ module ListSetOps (
 import Outputable
 import Unique  ( Unique )
 import UniqFM  ( eltsUFM, emptyUFM, addToUFM_C )
-import Util    ( isn'tIn, isIn, mapAccumR, sortLe )
+import Util    ( isn'tIn, isIn, sortLe )
 
-import Data.List ( partition )
+import Data.List
 \end{code}
 
 
index abde6d6..1d7f7a4 100644 (file)
@@ -32,7 +32,6 @@ module Util (
        transitiveClosure,
 
        -- accumulating
-       mapAccumL, mapAccumR, mapAccumB, 
        foldl2, count, all2,
        
        takeList, dropList, splitAtList, split,
@@ -488,62 +487,6 @@ transitiveClosure succ eq xs
 %*                                                                     *
 %************************************************************************
 
-@mapAccumL@ behaves like a combination
-of  @map@ and @foldl@;
-it applies a function to each element of a list, passing an accumulating
-parameter from left to right, and returning a final value of this
-accumulator together with the new list.
-
-\begin{code}
-mapAccumL :: (acc -> x -> (acc, y))    -- Function of elt of input list
-                                       -- and accumulator, returning new
-                                       -- accumulator and elt of result list
-           -> acc              -- Initial accumulator
-           -> [x]              -- Input list
-           -> (acc, [y])               -- Final accumulator and result list
-
-mapAccumL f b []     = (b, [])
-mapAccumL f b (x:xs) = (b'', x':xs') where
-                                         (b', x') = f b x
-                                         (b'', xs') = mapAccumL f b' xs
-\end{code}
-
-@mapAccumR@ does the same, but working from right to left instead.  Its type is
-the same as @mapAccumL@, though.
-
-\begin{code}
-mapAccumR :: (acc -> x -> (acc, y))    -- Function of elt of input list
-                                       -- and accumulator, returning new
-                                       -- accumulator and elt of result list
-           -> acc              -- Initial accumulator
-           -> [x]              -- Input list
-           -> (acc, [y])               -- Final accumulator and result list
-
-mapAccumR f b []     = (b, [])
-mapAccumR f b (x:xs) = (b'', x':xs') where
-                                         (b'', x') = f b' x
-                                         (b', xs') = mapAccumR f b xs
-\end{code}
-
-Here is the bi-directional version, that works from both left and right.
-
-\begin{code}
-mapAccumB :: (accl -> accr -> x -> (accl, accr,y))
-                               -- Function of elt of input list
-                               -- and accumulator, returning new
-                               -- accumulator and elt of result list
-         -> accl                       -- Initial accumulator from left
-         -> accr                       -- Initial accumulator from right
-         -> [x]                        -- Input list
-         -> (accl, accr, [y])  -- Final accumulators and result list
-
-mapAccumB f a b []     = (a,b,[])
-mapAccumB f a b (x:xs) = (a'',b'',y:ys)
-   where
-       (a',b'',y)  = f a b' x
-       (a'',b',ys) = mapAccumB f a' b xs
-\end{code}
-
 A strict version of foldl.
 
 \begin{code}