diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-12-29 21:03:35 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-01-12 09:36:28 -0500 |
commit | 2626debcd13d1226c922a6ce753ad1184bbbc3b6 (patch) | |
tree | d3e37e316a1a5ade411c27b9f77cefd7bdc83908 | |
parent | f75c4b5c224bfceaa92cdbe3a5f16dd94ea77c85 (diff) | |
download | haskell-2626debcd13d1226c922a6ce753ad1184bbbc3b6.tar.gz |
compiler: Qualify imports of Data.List
32 files changed, 56 insertions, 48 deletions
diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index f30c676e26..e7a33cf7af 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -54,7 +54,7 @@ import Util import qualified GHC.LanguageExtensions as LangExt import Panic -import Data.List +import Data.List ( partition ) import System.Exit import Control.Monad import System.FilePath diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs index f5b65e7638..e46d4a55b1 100644 --- a/compiler/basicTypes/Module.hs +++ b/compiler/basicTypes/Module.hs @@ -146,7 +146,7 @@ import UniqDSet import FastString import Binary import Util -import Data.List +import Data.List (sortBy, sort) import Data.Ord import GHC.PackageDb (BinaryStringRep(..), DbUnitIdModuleRep(..), DbModule(..), DbUnitId(..)) import Fingerprint diff --git a/compiler/basicTypes/PatSyn.hs b/compiler/basicTypes/PatSyn.hs index dddcb51319..e53279f668 100644 --- a/compiler/basicTypes/PatSyn.hs +++ b/compiler/basicTypes/PatSyn.hs @@ -38,7 +38,7 @@ import FieldLabel import qualified Data.Data as Data import Data.Function -import Data.List +import Data.List (find) {- ************************************************************************ diff --git a/compiler/basicTypes/SrcLoc.hs b/compiler/basicTypes/SrcLoc.hs index bcf2fcbd6e..cb0309e8b1 100644 --- a/compiler/basicTypes/SrcLoc.hs +++ b/compiler/basicTypes/SrcLoc.hs @@ -100,7 +100,7 @@ import FastString import Control.DeepSeq import Data.Bits import Data.Data -import Data.List +import Data.List (sortBy, intercalate) import Data.Ord {- diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 506116c584..28c2e74636 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -55,7 +55,7 @@ import qualified Data.ByteString as BS import Control.Monad.ST import Data.Bits import Data.Char -import Data.List +import Data.List (intersperse) import Data.Map (Map) import Data.Word import System.IO diff --git a/compiler/ghci/ByteCodeAsm.hs b/compiler/ghci/ByteCodeAsm.hs index 82de14346e..44876efc91 100644 --- a/compiler/ghci/ByteCodeAsm.hs +++ b/compiler/ghci/ByteCodeAsm.hs @@ -55,7 +55,7 @@ import Data.Array.Unsafe( castSTUArray ) import Foreign import Data.Char ( ord ) -import Data.List +import Data.List ( genericLength ) import Data.Map (Map) import Data.Maybe (fromMaybe) import qualified Data.Map as Map diff --git a/compiler/ghci/Debugger.hs b/compiler/ghci/Debugger.hs index a9bf9a87e9..e4f341f30c 100644 --- a/compiler/ghci/Debugger.hs +++ b/compiler/ghci/Debugger.hs @@ -40,7 +40,7 @@ import DynFlags import Exception import Control.Monad -import Data.List +import Data.List ( (\\) ) import Data.Maybe import Data.IORef diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index f8bf25b642..ac043ed95a 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -57,7 +57,7 @@ import Control.Monad import Data.Char (isSpace) import Data.IORef -import Data.List +import Data.List (intercalate, isPrefixOf, isSuffixOf, nub, partition) import Data.Maybe import Control.Concurrent.MVar diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs index 9fe18a57cf..6c78f78f47 100644 --- a/compiler/ghci/RtClosureInspect.hs +++ b/compiler/ghci/RtClosureInspect.hs @@ -62,7 +62,7 @@ import SMRep ( roundUpTo ) import Control.Monad import Data.Maybe -import Data.List +import Data.List ((\\)) #if defined(INTEGER_GMP) import GHC.Exts import Data.Array.Base diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index cb9e183c1a..8e66a67f58 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -113,7 +113,7 @@ import ExtractDocs import Control.Monad import Data.Function -import Data.List +import Data.List (find, findIndex, mapAccumL, sortBy, sort) import qualified Data.Map as Map import qualified Data.Set as Set import Data.Ord diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index 3d2ac983a4..9bb6b4e391 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -164,7 +164,7 @@ import Stream (Stream) import Util -import Data.List +import Data.List ( nub, isPrefixOf, partition ) import Control.Monad import Data.IORef import System.FilePath as FilePath diff --git a/compiler/main/Plugins.hs b/compiler/main/Plugins.hs index 790acdc2fc..25e69c15e5 100644 --- a/compiler/main/Plugins.hs +++ b/compiler/main/Plugins.hs @@ -60,7 +60,7 @@ import GhcMonad import DriverPhases import Module ( ModuleName, Module(moduleName)) import Fingerprint -import Data.List +import Data.List (sort) import Outputable (Outputable(..), text, (<+>)) --Qualified import so we can define a Semigroup instance diff --git a/compiler/nativeGen/CFG.hs b/compiler/nativeGen/CFG.hs index fb17d269a8..11449f1a03 100644 --- a/compiler/nativeGen/CFG.hs +++ b/compiler/nativeGen/CFG.hs @@ -81,7 +81,7 @@ import Outputable import PprCmm () -- For Outputable instances import qualified DynFlags as D -import Data.List +import Data.List (sort, nub, partition) import Data.STRef.Strict import Control.Monad.ST diff --git a/compiler/nativeGen/Reg.hs b/compiler/nativeGen/Reg.hs index 7f69ea01a4..3808434d62 100644 --- a/compiler/nativeGen/Reg.hs +++ b/compiler/nativeGen/Reg.hs @@ -31,7 +31,7 @@ import GhcPrelude import Outputable import Unique import RegClass -import Data.List +import Data.List (intersect) -- | An identifier for a primitive real machine register. type RegNo diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index fde925063b..7135c89e98 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -68,7 +68,7 @@ import UniqFM ( UniqFM, mapUFM, filterUFM ) import MonadUtils import NameCache import SrcLoc -import Data.List +import Data.List (intersperse, groupBy, sortBy) import Data.Ord import Data.Dynamic import Data.IORef diff --git a/compiler/simplCore/SAT.hs b/compiler/simplCore/SAT.hs index e9a62d530d..23e2b601d3 100644 --- a/compiler/simplCore/SAT.hs +++ b/compiler/simplCore/SAT.hs @@ -69,7 +69,7 @@ import Unique import UniqSet import Outputable -import Data.List +import Data.List (mapAccumL) import FastString #include "HsVersions.h" diff --git a/compiler/simplCore/SimplEnv.hs b/compiler/simplCore/SimplEnv.hs index a17d6b4bda..2f1d5a72a0 100644 --- a/compiler/simplCore/SimplEnv.hs +++ b/compiler/simplCore/SimplEnv.hs @@ -69,7 +69,7 @@ import Outputable import Util import UniqFM ( pprUniqFM ) -import Data.List +import Data.List (mapAccumL) {- ************************************************************************ diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index afde951e60..86806bab0a 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -23,7 +23,7 @@ import CoreSeq ( seqBinds ) import Outputable import VarEnv import BasicTypes -import Data.List +import Data.List ( mapAccumL, sortBy ) import DataCon import Id import CoreUtils ( exprIsHNF, exprType, exprIsTrivial, exprOkForSpeculation ) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index a6c44d0c45..876acac832 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -70,7 +70,7 @@ import qualified GHC.LanguageExtensions as LangExt import Control.Monad import Control.Monad.Trans.Class import Control.Monad.Trans.Reader -import Data.List +import Data.List (partition, find) {- ************************************************************************ diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index 97dffcd1cf..781e540c6c 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -50,7 +50,7 @@ import VarSet import Control.Monad import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Reader (ask) -import Data.List +import Data.List (sortBy) import Data.Maybe ---------------------- diff --git a/compiler/typecheck/TcEnv.hs b/compiler/typecheck/TcEnv.hs index d9bd893dc5..5394f875fb 100644 --- a/compiler/typecheck/TcEnv.hs +++ b/compiler/typecheck/TcEnv.hs @@ -112,7 +112,7 @@ import qualified GHC.LanguageExtensions as LangExt import Util ( HasDebugCallStack ) import Data.IORef -import Data.List +import Data.List (intercalate) import Control.Monad {- ********************************************************************* diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index c7921070f6..d2057abcf2 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -81,7 +81,7 @@ import UniqSet ( nonDetEltsUniqSet ) import qualified GHC.LanguageExtensions as LangExt import Data.Function -import Data.List +import Data.List (partition, sortBy, groupBy, intersect) import qualified Data.Set as Set {- diff --git a/compiler/types/TyCoSubst.hs b/compiler/types/TyCoSubst.hs index 5c557f595d..13e45a0d9a 100644 --- a/compiler/types/TyCoSubst.hs +++ b/compiler/types/TyCoSubst.hs @@ -79,7 +79,7 @@ import UniqFM import UniqSet import Outputable -import Data.List +import Data.List (mapAccumL) {- %************************************************************************ diff --git a/compiler/types/TyCoTidy.hs b/compiler/types/TyCoTidy.hs index 5c0825a6fa..91cfcdd084 100644 --- a/compiler/types/TyCoTidy.hs +++ b/compiler/types/TyCoTidy.hs @@ -26,7 +26,7 @@ import Var import VarEnv import Util (seqList) -import Data.List +import Data.List (mapAccumL) {- %************************************************************************ diff --git a/compiler/utils/GraphPpr.hs b/compiler/utils/GraphPpr.hs index c39395eda8..2210d07273 100644 --- a/compiler/utils/GraphPpr.hs +++ b/compiler/utils/GraphPpr.hs @@ -16,7 +16,7 @@ import Unique import UniqSet import UniqFM -import Data.List +import Data.List (mapAccumL) import Data.Maybe diff --git a/compiler/utils/ListSetOps.hs b/compiler/utils/ListSetOps.hs index a8b717df00..85233c9533 100644 --- a/compiler/utils/ListSetOps.hs +++ b/compiler/utils/ListSetOps.hs @@ -28,7 +28,7 @@ import GhcPrelude import Outputable import Util -import Data.List +import qualified Data.List as L import qualified Data.List.NonEmpty as NE import Data.List.NonEmpty (NonEmpty(..)) import qualified Data.Set as S @@ -40,7 +40,7 @@ getNth xs n = ASSERT2( xs `lengthExceeds` n, ppr n $$ ppr xs ) deleteBys :: (a -> a -> Bool) -> [a] -> [a] -> [a] -- (deleteBys eq xs ys) returns xs-ys, using the given equality function -- Just like 'Data.List.delete' but with an equality function -deleteBys eq xs ys = foldl' (flip (deleteBy eq)) xs ys +deleteBys eq xs ys = foldl' (flip (L.deleteBy eq)) xs ys {- ************************************************************************ @@ -153,7 +153,7 @@ equivClasses :: (a -> a -> Ordering) -- Comparison equivClasses _ [] = [] equivClasses _ [stuff] = [stuff :| []] -equivClasses cmp items = NE.groupBy eq (sortBy cmp items) +equivClasses cmp items = NE.groupBy eq (L.sortBy cmp items) where eq a b = case cmp a b of { EQ -> True; _ -> False } @@ -166,7 +166,7 @@ removeDups :: (a -> a -> Ordering) -- Comparison function removeDups _ [] = ([], []) removeDups _ [x] = ([x],[]) removeDups cmp xs - = case (mapAccumR collect_dups [] (equivClasses cmp xs)) of { (dups, xs') -> + = case L.mapAccumR collect_dups [] (equivClasses cmp xs) of { (dups, xs') -> (xs', dups) } where collect_dups :: [NonEmpty a] -> NonEmpty a -> ([NonEmpty a], a) @@ -175,6 +175,6 @@ removeDups cmp xs findDupsEq :: (a->a->Bool) -> [a] -> [NonEmpty a] findDupsEq _ [] = [] -findDupsEq eq (x:xs) | null eq_xs = findDupsEq eq xs - | otherwise = (x :| eq_xs) : findDupsEq eq neq_xs - where (eq_xs, neq_xs) = partition (eq x) xs +findDupsEq eq (x:xs) | L.null eq_xs = findDupsEq eq xs + | otherwise = (x :| eq_xs) : findDupsEq eq neq_xs + where (eq_xs, neq_xs) = L.partition (eq x) xs diff --git a/ghc/Main.hs b/ghc/Main.hs index b66f567d2f..9c0029f56f 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -80,7 +80,7 @@ import Control.Monad import Control.Monad.Trans.Class import Control.Monad.Trans.Except (throwE, runExceptT) import Data.Char -import Data.List +import Data.List ( isPrefixOf, partition, intercalate ) import Data.Maybe import Prelude diff --git a/libraries/base/Data/Version.hs b/libraries/base/Data/Version.hs index 6fb0169d12..6a284642c1 100644 --- a/libraries/base/Data/Version.hs +++ b/libraries/base/Data/Version.hs @@ -42,7 +42,7 @@ import Data.Bool ( (&&) ) import Data.Char ( isDigit, isAlphaNum ) import Data.Eq import Data.Int ( Int ) -import Data.List +import Data.List ( map, sort, concat, concatMap, intersperse, (++) ) import Data.Ord import Data.String ( String ) import GHC.Generics diff --git a/libraries/base/Debug/Trace.hs b/libraries/base/Debug/Trace.hs index cfeefbc0ae..1b977bae6e 100644 --- a/libraries/base/Debug/Trace.hs +++ b/libraries/base/Debug/Trace.hs @@ -53,7 +53,7 @@ import GHC.IO.Encoding import GHC.Ptr import GHC.Show import GHC.Stack -import Data.List +import Data.List (null, partition) -- $setup -- >>> import Prelude diff --git a/libraries/base/Prelude.hs b/libraries/base/Prelude.hs index f7b2fd9c2e..66ea603e72 100644 --- a/libraries/base/Prelude.hs +++ b/libraries/base/Prelude.hs @@ -101,25 +101,32 @@ module Prelude ( seq, ($!), -- * List operations - map, (++), filter, - head, last, tail, init, null, length, (!!), - reverse, + List.map, (List.++), List.filter, + List.head, List.last, List.tail, List.init, (List.!!), + Foldable.null, Foldable.length, + List.reverse, -- *** Special folds - and, or, any, all, - concat, concatMap, + Foldable.and, Foldable.or, Foldable.any, Foldable.all, + Foldable.concat, Foldable.concatMap, -- ** Building lists -- *** Scans - scanl, scanl1, scanr, scanr1, + List.scanl, List.scanl1, List.scanr, List.scanr1, -- *** Infinite lists - iterate, repeat, replicate, cycle, + List.iterate, List.repeat, List.replicate, List.cycle, -- ** Sublists - take, drop, splitAt, takeWhile, dropWhile, span, break, + List.take, List.drop, + List.takeWhile, List.dropWhile, + List.span, List.break, + List.splitAt, -- ** Searching lists - notElem, lookup, + Foldable.notElem, + List.lookup, -- ** Zipping and unzipping lists - zip, zip3, zipWith, zipWith3, unzip, unzip3, + List.zip, List.zip3, + List.zipWith, List.zipWith3, + List.unzip, List.unzip3, -- ** Functions on strings - lines, words, unlines, unwords, + List.lines, List.words, List.unlines, List.unwords, -- * Converting to and from @String@ -- ** Converting to @String@ @@ -157,9 +164,10 @@ module Prelude ( import Control.Monad import System.IO import System.IO.Error -import Data.List +import qualified Data.List as List import Data.Either import Data.Foldable ( Foldable(..) ) +import qualified Data.Foldable as Foldable import Data.Functor ( (<$>) ) import Data.Maybe import Data.Traversable ( Traversable(..) ) diff --git a/libraries/base/Text/Printf.hs b/libraries/base/Text/Printf.hs index a97a0fd4f0..d180b84a72 100644 --- a/libraries/base/Text/Printf.hs +++ b/libraries/base/Text/Printf.hs @@ -93,7 +93,7 @@ module Text.Printf( import Data.Char import Data.Int -import Data.List +import Data.List (stripPrefix) import Data.Word import Numeric import Numeric.Natural diff --git a/libraries/hpc b/libraries/hpc -Subproject f73c482db30a40cfa12074de51335b70a097493 +Subproject 9dc203130af88fc983c9014a873a7d46ef9330e |