From 49939073c2530fd710d13af3a6ce1db4fbb670d5 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Fri, 1 Jan 2016 18:11:46 -0800 Subject: [PATCH] Remove same-package import lists, fixes #2835. Instead of qualifying, in some cases I just added an extra 'hiding' pragma to squelch errors. Signed-off-by: Edward Z. Yang --- Cabal/Cabal.cabal | 1 + Cabal/Distribution/Compat/CopyFile.hs | 6 +- .../Distribution/Compat/Internal/TempFile.hs | 2 +- Cabal/Distribution/Compiler.hs | 6 +- Cabal/Distribution/InstalledPackageInfo.hs | 45 +++---------- Cabal/Distribution/License.hs | 8 +-- Cabal/Distribution/Make.hs | 11 ++-- Cabal/Distribution/ModuleName.hs | 5 +- Cabal/Distribution/Package.hs | 20 +++++- Cabal/Distribution/PackageDescription.hs | 30 ++++----- .../Distribution/PackageDescription/Check.hs | 65 +++++++------------ .../PackageDescription/Configuration.hs | 17 +---- .../Distribution/PackageDescription/Parse.hs | 41 +++++------- .../PackageDescription/PrettyPrint.hs | 23 +++---- Cabal/Distribution/ParseUtils.hs | 14 ++-- Cabal/Distribution/Simple.hs | 47 ++++---------- Cabal/Distribution/Simple/Bench.hs | 14 ++-- Cabal/Distribution/Simple/Build.hs | 38 ++--------- .../Distribution/Simple/Build/PathsModule.hs | 8 --- Cabal/Distribution/Simple/BuildPaths.hs | 17 ++--- Cabal/Distribution/Simple/BuildTarget.hs | 33 +++------- Cabal/Distribution/Simple/Command.hs | 12 ++-- Cabal/Distribution/Simple/Compiler.hs | 10 +-- Cabal/Distribution/Simple/Configure.hs | 61 +++-------------- Cabal/Distribution/Simple/GHC.hs | 29 +-------- Cabal/Distribution/Simple/GHC/IPI641.hs | 9 +-- Cabal/Distribution/Simple/GHC/IPI642.hs | 41 +----------- Cabal/Distribution/Simple/GHC/IPIConvert.hs | 51 +++++++++++++++ Cabal/Distribution/Simple/GHC/ImplInfo.hs | 4 +- Cabal/Distribution/Simple/GHC/Internal.hs | 27 ++------ Cabal/Distribution/Simple/Haddock.hs | 51 ++------------- Cabal/Distribution/Simple/HaskellSuite.hs | 1 - Cabal/Distribution/Simple/InstallDirs.hs | 14 ++-- Cabal/Distribution/Simple/JHC.hs | 23 +------ Cabal/Distribution/Simple/LHC.hs | 33 +--------- Cabal/Distribution/Simple/LocalBuildInfo.hs | 18 +---- Cabal/Distribution/Simple/PackageIndex.hs | 31 ++++----- Cabal/Distribution/Simple/PreProcess.hs | 30 +-------- Cabal/Distribution/Simple/Program.hs | 3 - Cabal/Distribution/Simple/Program/Builtin.hs | 13 +--- Cabal/Distribution/Simple/Program/Db.hs | 14 +--- Cabal/Distribution/Simple/Program/Find.hs | 11 ++-- Cabal/Distribution/Simple/Program/GHC.hs | 9 ++- Cabal/Distribution/Simple/Program/HcPkg.hs | 16 +---- Cabal/Distribution/Simple/Program/Hpc.hs | 13 ++-- Cabal/Distribution/Simple/Program/Run.hs | 7 +- Cabal/Distribution/Simple/Program/Script.hs | 2 - Cabal/Distribution/Simple/Program/Strip.hs | 13 ++-- Cabal/Distribution/Simple/Program/Types.hs | 6 +- Cabal/Distribution/Simple/Register.hs | 35 ++-------- Cabal/Distribution/Simple/Setup.hs | 35 +++------- Cabal/Distribution/Simple/SrcDist.hs | 50 +++++--------- Cabal/Distribution/Simple/Test.hs | 17 ++--- Cabal/Distribution/Simple/Test/ExeV10.hs | 20 +++--- Cabal/Distribution/Simple/Test/LibV09.hs | 24 +++---- Cabal/Distribution/Simple/Test/Log.hs | 20 +++--- Cabal/Distribution/Simple/UHC.hs | 9 +-- Cabal/Distribution/Simple/UserHooks.hs | 13 ++-- Cabal/Distribution/Simple/Utils.hs | 47 +++++--------- Cabal/Distribution/System.hs | 7 +- Cabal/Distribution/Utils/NubList.hs | 3 +- Cabal/Distribution/Verbosity.hs | 5 +- Cabal/Distribution/Version.hs | 5 +- Cabal/Language/Haskell/Extension.hs | 5 +- 64 files changed, 400 insertions(+), 898 deletions(-) create mode 100644 Cabal/Distribution/Simple/GHC/IPIConvert.hs diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index cd0247a2bcb..abdeee9c997 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -262,6 +262,7 @@ library Distribution.Simple.GHC.Internal Distribution.Simple.GHC.IPI641 Distribution.Simple.GHC.IPI642 + Distribution.Simple.GHC.IPIConvert Distribution.Simple.GHC.ImplInfo Paths_Cabal diff --git a/Cabal/Distribution/Compat/CopyFile.hs b/Cabal/Distribution/Compat/CopyFile.hs index f306ad1b9a0..486a2096c4d 100644 --- a/Cabal/Distribution/Compat/CopyFile.hs +++ b/Cabal/Distribution/Compat/CopyFile.hs @@ -11,20 +11,18 @@ module Distribution.Compat.CopyFile ( setDirOrdinary, ) where +import Distribution.Compat.Exception +import Distribution.Compat.Internal.TempFile import Control.Monad ( when, unless ) import Control.Exception ( bracketOnError, throwIO ) import qualified Data.ByteString.Lazy as BSL -import Distribution.Compat.Exception - ( catchIO ) import System.IO.Error ( ioeSetLocation ) import System.Directory ( doesFileExist, renameFile, removeFile ) -import Distribution.Compat.Internal.TempFile - ( openBinaryTempFile ) import System.FilePath ( takeDirectory ) import System.IO diff --git a/Cabal/Distribution/Compat/Internal/TempFile.hs b/Cabal/Distribution/Compat/Internal/TempFile.hs index 4e70c8bee40..edb2b8808f9 100644 --- a/Cabal/Distribution/Compat/Internal/TempFile.hs +++ b/Cabal/Distribution/Compat/Internal/TempFile.hs @@ -7,6 +7,7 @@ module Distribution.Compat.Internal.TempFile ( createTempDirectory, ) where +import Distribution.Compat.Exception import System.FilePath (()) import Foreign.C (CInt, eEXIST, getErrno, errnoToIOError) @@ -18,7 +19,6 @@ import System.Posix.Internals (c_open, c_close, o_CREAT, o_EXCL, o_RDWR, withFilePath, c_getpid) import System.IO.Error (isAlreadyExistsError) import GHC.IO.Handle.FD (fdToHandle) -import Distribution.Compat.Exception (tryIO) import Control.Exception (onException) #if defined(mingw32_HOST_OS) || defined(ghcjs_HOST_OS) diff --git a/Cabal/Distribution/Compiler.hs b/Cabal/Distribution/Compiler.hs index 62a83ab427a..4e84d799e7c 100644 --- a/Cabal/Distribution/Compiler.hs +++ b/Cabal/Distribution/Compiler.hs @@ -42,15 +42,15 @@ module Distribution.Compiler ( AbiTag(..), abiTagString ) where -import Distribution.Compat.Binary (Binary) +import Distribution.Compat.Binary +import Language.Haskell.Extension + import Data.Data (Data) import Data.Typeable (Typeable) import Data.Maybe (fromMaybe) import Distribution.Version (Version(..)) import GHC.Generics (Generic) -import Language.Haskell.Extension (Language, Extension) - import qualified System.Info (compilerName, compilerVersion) import Distribution.Text (Text(..), display) import qualified Distribution.Compat.ReadP as Parse diff --git a/Cabal/Distribution/InstalledPackageInfo.hs b/Cabal/Distribution/InstalledPackageInfo.hs index 1315dd6a74c..482073bebf5 100644 --- a/Cabal/Distribution/InstalledPackageInfo.hs +++ b/Cabal/Distribution/InstalledPackageInfo.hs @@ -27,7 +27,6 @@ -- This module is meant to be local-only to Distribution... module Distribution.InstalledPackageInfo ( - AbiHash(..), InstalledPackageInfo(..), OriginalModule(..), ExposedModule(..), ParseResult(..), PError(..), PWarning, @@ -40,32 +39,18 @@ module Distribution.InstalledPackageInfo ( ) where import Distribution.ParseUtils - ( FieldDescr(..), ParseResult(..), PError(..), PWarning - , simpleField, listField, parseLicenseQ - , showFields, showSingleNamedField, showSimpleSingleNamedField - , parseFieldsFlat - , parseFilePathQ, parseTokenQ, parseModuleNameQ, parsePackageNameQ - , showFilePath, showToken, boolField, parseOptVersion - , parseFreeText, showFreeText, parseOptCommaList ) -import Distribution.License ( License(..) ) -import Distribution.Package - ( PackageName(..), PackageIdentifier(..) - , PackageId, ComponentId(..) - , packageName, packageVersion, ComponentId(..) ) +import Distribution.License +import Distribution.Package hiding (installedComponentId) import qualified Distribution.Package as Package import Distribution.ModuleName - ( ModuleName ) import Distribution.Version - ( Version(..) ) import Distribution.Text - ( Text(disp, parse) ) -import Text.PrettyPrint as Disp import qualified Distribution.Compat.ReadP as Parse +import Distribution.Compat.Binary -import Distribution.Compat.Binary (Binary) +import Text.PrettyPrint as Disp import Data.Maybe (fromMaybe) import GHC.Generics (Generic) -import qualified Data.Char as Char -- ----------------------------------------------------------------------------- -- The InstalledPackageInfo type @@ -92,7 +77,7 @@ data InstalledPackageInfo abiHash :: AbiHash, exposed :: Bool, exposedModules :: [ExposedModule], - instantiatedWith :: [(ModuleName, OriginalModule)], + installedInstantiatedWith :: [(ModuleName, OriginalModule)], hiddenModules :: [ModuleName], trusted :: Bool, importDirs :: [FilePath], @@ -128,7 +113,7 @@ instance Package.PackageInstalled InstalledPackageInfo where emptyInstalledPackageInfo :: InstalledPackageInfo emptyInstalledPackageInfo = InstalledPackageInfo { - sourcePackageId = PackageIdentifier (PackageName "") noVersion, + sourcePackageId = PackageIdentifier (PackageName "") (Version [] []), installedComponentId = ComponentId "", compatPackageKey = ComponentId "", license = UnspecifiedLicense, @@ -145,7 +130,7 @@ emptyInstalledPackageInfo exposed = False, exposedModules = [], hiddenModules = [], - instantiatedWith = [], + installedInstantiatedWith = [], trusted = False, importDirs = [], libraryDirs = [], @@ -165,20 +150,6 @@ emptyInstalledPackageInfo pkgRoot = Nothing } -noVersion :: Version -noVersion = Version [] [] - --- ----------------------------------------------------------------------------- --- Exposed modules - -newtype AbiHash = AbiHash String - deriving (Eq, Show, Read, Generic) -instance Binary AbiHash - -instance Text AbiHash where - disp (AbiHash abi) = Disp.text abi - parse = fmap AbiHash (Parse.munch Char.isAlphaNum) - -- ----------------------------------------------------------------------------- -- Exposed modules @@ -348,7 +319,7 @@ installedFieldDescrs = [ abiHash (\abi pkg -> pkg{abiHash=abi}) , listField "instantiated-with" showInstantiatedWith parseInstantiatedWith - instantiatedWith (\xs pkg -> pkg{instantiatedWith=xs}) + installedInstantiatedWith (\xs pkg -> pkg{installedInstantiatedWith=xs}) , boolField "trusted" trusted (\val pkg -> pkg{trusted=val}) , listField "import-dirs" diff --git a/Cabal/Distribution/License.hs b/Cabal/Distribution/License.hs index 1d06e4af987..dc3515cf176 100644 --- a/Cabal/Distribution/License.hs +++ b/Cabal/Distribution/License.hs @@ -47,13 +47,13 @@ module Distribution.License ( knownLicenses, ) where -import Distribution.Version (Version(Version)) - -import Distribution.Text (Text(..), display) +import Distribution.Version +import Distribution.Text import qualified Distribution.Compat.ReadP as Parse +import Distribution.Compat.Binary + import qualified Text.PrettyPrint as Disp import Text.PrettyPrint ((<>)) -import Distribution.Compat.Binary (Binary) import qualified Data.Char as Char (isAlphaNum) import Data.Data (Data) import Data.Typeable (Typeable) diff --git a/Cabal/Distribution/Make.hs b/Cabal/Distribution/Make.hs index 4826e7d4e49..c29a073f5f3 100644 --- a/Cabal/Distribution/Make.hs +++ b/Cabal/Distribution/Make.hs @@ -62,22 +62,19 @@ module Distribution.Make ( -- local import Distribution.Compat.Exception -import Distribution.Package --must not specify imports, since we're exporting moule. -import Distribution.Simple.Program(defaultProgramConfiguration) +import Distribution.Package +import Distribution.Simple.Program import Distribution.PackageDescription import Distribution.Simple.Setup import Distribution.Simple.Command -import Distribution.Simple.Utils (rawSystemExit, cabalVersion) +import Distribution.Simple.Utils -import Distribution.License (License(..)) +import Distribution.License import Distribution.Version - ( Version(..) ) import Distribution.Text - ( display ) import System.Environment (getArgs, getProgName) -import Data.List (intercalate) import System.Exit defaultMain :: IO () diff --git a/Cabal/Distribution/ModuleName.hs b/Cabal/Distribution/ModuleName.hs index 9d04513a93a..a0d30aea734 100644 --- a/Cabal/Distribution/ModuleName.hs +++ b/Cabal/Distribution/ModuleName.hs @@ -22,14 +22,13 @@ module Distribution.ModuleName ( ) where import Distribution.Text - ( Text(..) ) +import Distribution.Compat.Binary +import qualified Distribution.Compat.ReadP as Parse -import Distribution.Compat.Binary (Binary) import qualified Data.Char as Char ( isAlphaNum, isUpper ) import Data.Data (Data) import Data.Typeable (Typeable) -import qualified Distribution.Compat.ReadP as Parse import qualified Text.PrettyPrint as Disp import Data.List ( intercalate, intersperse ) diff --git a/Cabal/Distribution/Package.hs b/Cabal/Distribution/Package.hs index c20164504d1..7f631322c0e 100644 --- a/Cabal/Distribution/Package.hs +++ b/Cabal/Distribution/Package.hs @@ -26,6 +26,9 @@ module Distribution.Package ( getHSLibraryName, InstalledPackageId, -- backwards compat + -- * ABI hash + AbiHash(..), + -- * Package source dependencies Dependency(..), thisPackageVersion, @@ -42,13 +45,13 @@ import Distribution.Version ( Version(..), VersionRange, anyVersion, thisVersion , notThisVersion, simplifyVersionRange ) -import Distribution.Text (Text(..)) import qualified Distribution.Compat.ReadP as Parse -import Distribution.Compat.ReadP ((<++)) import qualified Text.PrettyPrint as Disp +import Distribution.Compat.ReadP +import Distribution.Compat.Binary +import Distribution.Text import Control.DeepSeq (NFData(..)) -import Distribution.Compat.Binary (Binary) import qualified Data.Char as Char ( isDigit, isAlphaNum, ) import Data.Data ( Data ) @@ -202,3 +205,14 @@ class Package pkg => HasComponentId pkg where -- Installed packages have exact dependencies 'installedDepends'. class (HasComponentId pkg) => PackageInstalled pkg where installedDepends :: pkg -> [ComponentId] + +-- ----------------------------------------------------------------------------- +-- ABI hash + +newtype AbiHash = AbiHash String + deriving (Eq, Show, Read, Generic) +instance Binary AbiHash + +instance Text AbiHash where + disp (AbiHash abi) = Disp.text abi + parse = fmap AbiHash (Parse.munch Char.isAlphaNum) diff --git a/Cabal/Distribution/PackageDescription.hs b/Cabal/Distribution/PackageDescription.hs index db5a31cb555..996fdc45a10 100644 --- a/Cabal/Distribution/PackageDescription.hs +++ b/Cabal/Distribution/PackageDescription.hs @@ -109,9 +109,20 @@ module Distribution.PackageDescription ( SetupBuildInfo(..), ) where -import Distribution.Compat.Binary (Binary) +import Distribution.Compat.Binary import qualified Distribution.Compat.Semigroup as Semi ((<>)) import Distribution.Compat.Semigroup as Semi (Monoid(..), Semigroup) +import qualified Distribution.Compat.ReadP as Parse +import Distribution.Compat.ReadP ((<++)) +import Distribution.Package +import Distribution.ModuleName +import Distribution.Version +import Distribution.License +import Distribution.Compiler +import Distribution.System +import Distribution.Text +import Language.Haskell.Extension + import Data.Data (Data) import Data.Foldable (traverse_) import Data.List (nub, intercalate) @@ -123,27 +134,10 @@ import Control.Applicative as AP (Alternative(..), Applicative(..)) import Control.Monad (MonadPlus(mplus,mzero), ap) import GHC.Generics (Generic) import Text.PrettyPrint as Disp -import qualified Distribution.Compat.ReadP as Parse -import Distribution.Compat.ReadP ((<++)) import qualified Data.Char as Char (isAlphaNum, isDigit, toLower) import qualified Data.Map as Map import Data.Map (Map) -import Distribution.Package - ( PackageName(PackageName), PackageIdentifier(PackageIdentifier) - , Dependency, Package(..), PackageName, packageName ) -import Distribution.ModuleName ( ModuleName ) -import Distribution.Version - ( Version(Version), VersionRange, anyVersion, orLaterVersion - , asVersionIntervals, LowerBound(..) ) -import Distribution.License (License(UnspecifiedLicense)) -import Distribution.Compiler (CompilerFlavor) -import Distribution.System (OS, Arch) -import Distribution.Text - ( Text(..), display ) -import Language.Haskell.Extension - ( Language, Extension ) - -- ----------------------------------------------------------------------------- -- The PackageDescription type diff --git a/Cabal/Distribution/PackageDescription/Check.hs b/Cabal/Distribution/PackageDescription/Check.hs index 96e457fa1a3..cfa41b850aa 100644 --- a/Cabal/Distribution/PackageDescription/Check.hs +++ b/Cabal/Distribution/PackageDescription/Check.hs @@ -33,50 +33,30 @@ module Distribution.PackageDescription.Check ( checkPackageFileNames, ) where -import Data.Maybe - ( isNothing, isJust, catMaybes, mapMaybe, maybeToList, fromMaybe ) -import Data.List (sort, group, isPrefixOf, nub, find) -import Control.Monad - ( filterM, liftM ) -import qualified System.Directory as System - ( doesFileExist, doesDirectoryExist ) -import qualified Data.Map as Map - import Distribution.PackageDescription import Distribution.PackageDescription.Configuration - ( flattenPackageDescription, finalizePackageDescription ) import Distribution.Compiler - ( CompilerFlavor(..), buildCompilerFlavor, CompilerId(..) - , unknownCompilerInfo, AbiTag(..) ) import Distribution.System - ( OS(..), Arch(..), buildPlatform ) import Distribution.License - ( License(..), knownLicenses ) import Distribution.Simple.CCompiler - ( filenameCDialect ) -import Distribution.Simple.Utils - ( cabalVersion, intercalate, parseFileGlob, FileGlob(..), lowercase, startsWithBOM, fromUTF8 ) - +import Distribution.Simple.Utils hiding (findPackageDesc, notice) import Distribution.Version - ( Version(..) - , VersionRange(..), foldVersionRange' - , anyVersion, noVersion, thisVersion, laterVersion, earlierVersion - , orLaterVersion, orEarlierVersion - , unionVersionRanges, intersectVersionRanges - , asVersionIntervals, UpperBound(..), isNoVersion ) import Distribution.Package - ( PackageName(PackageName), packageName, packageVersion - , Dependency(..), pkgName ) - import Distribution.Text - ( display, disp ) +import Language.Haskell.Extension + +import Data.Maybe + ( isNothing, isJust, catMaybes, mapMaybe, maybeToList, fromMaybe ) +import Data.List (sort, group, isPrefixOf, nub, find) +import Control.Monad + ( filterM, liftM ) +import qualified System.Directory as System + ( doesFileExist, doesDirectoryExist ) +import qualified Data.Map as Map + import qualified Text.PrettyPrint as Disp import Text.PrettyPrint ((<>), (<+>)) -import qualified Language.Haskell.Extension as Extension (deprecatedExtensions) -import Language.Haskell.Extension - ( Language(UnknownLanguage), knownLanguages - , Extension(..), KnownExtension(..) ) import qualified System.Directory (getDirectoryContents) import System.IO (openBinaryFile, IOMode(ReadMode), hGetContents) import System.FilePath @@ -442,14 +422,14 @@ checkFields pkg = ++ ". Languages must be specified in either the 'default-language' " ++ " or the 'other-languages' field." - , check (not (null deprecatedExtensions)) $ + , check (not (null ourDeprecatedExtensions)) $ PackageDistSuspicious $ "Deprecated extensions: " - ++ commaSep (map (quote . display . fst) deprecatedExtensions) + ++ commaSep (map (quote . display . fst) ourDeprecatedExtensions) ++ ". " ++ unwords [ "Instead of '" ++ display ext ++ "' use '" ++ display replacement ++ "'." - | (ext, Just replacement) <- deprecatedExtensions ] + | (ext, Just replacement) <- ourDeprecatedExtensions ] , check (null (category pkg)) $ PackageDistSuspicious "No 'category' field." @@ -491,8 +471,8 @@ checkFields pkg = unknownExtensions = [ name | bi <- allBuildInfo pkg , UnknownExtension name <- allExtensions bi , name `notElem` map display knownLanguages ] - deprecatedExtensions = nub $ catMaybes - [ find ((==ext) . fst) Extension.deprecatedExtensions + ourDeprecatedExtensions = nub $ catMaybes + [ find ((==ext) . fst) deprecatedExtensions | bi <- allBuildInfo pkg , ext <- allExtensions bi ] languagesUsedAsExtensions = @@ -1340,10 +1320,10 @@ checkConditionals pkg = unknownOSs = [ os | OS (OtherOS os) <- conditions ] unknownArches = [ arch | Arch (OtherArch arch) <- conditions ] unknownImpls = [ impl | Impl (OtherCompiler impl) _ <- conditions ] - conditions = maybe [] freeVars (condLibrary pkg) - ++ concatMap (freeVars . snd) (condExecutables pkg) - freeVars (CondNode _ _ ifs) = concatMap compfv ifs - compfv (c, ct, mct) = condfv c ++ freeVars ct ++ maybe [] freeVars mct + conditions = maybe [] fvs (condLibrary pkg) + ++ concatMap (fvs . snd) (condExecutables pkg) + fvs (CondNode _ _ ifs) = concatMap compfv ifs -- free variables + compfv (c, ct, mct) = condfv c ++ fvs ct ++ maybe [] fvs mct condfv c = case c of Var v -> [v] Lit _ -> [] @@ -1537,7 +1517,8 @@ checkCabalFileBOM ops = do pdfile ++ " starts with an Unicode byte order mark (BOM). This may cause problems with older cabal versions." -- |Find a package description file in the given directory. Looks for --- @.cabal@ files. +-- @.cabal@ files. Like 'Distribution.Simple.Utils.findPackageDesc', +-- but generalized over monads. findPackageDesc :: Monad m => CheckPackageContentOps m -> m (Either PackageCheck FilePath) -- ^.cabal findPackageDesc ops diff --git a/Cabal/Distribution/PackageDescription/Configuration.hs b/Cabal/Distribution/PackageDescription/Configuration.hs index d9d4173eee1..1c7cb3edd8e 100644 --- a/Cabal/Distribution/PackageDescription/Configuration.hs +++ b/Cabal/Distribution/PackageDescription/Configuration.hs @@ -29,33 +29,18 @@ module Distribution.PackageDescription.Configuration ( ) where import Distribution.Package - ( PackageName, Dependency(..) ) import Distribution.PackageDescription - ( GenericPackageDescription(..), PackageDescription(..) - , Library(..), Executable(..), BuildInfo(..) - , Flag(..), FlagName(..), FlagAssignment - , Benchmark(..), CondTree(..), ConfVar(..), Condition(..) - , TestSuite(..) ) import Distribution.PackageDescription.Utils - ( cabalBug, userBug ) import Distribution.Version - ( VersionRange, anyVersion, intersectVersionRanges, withinRange ) import Distribution.Compiler - ( CompilerId(CompilerId) ) import Distribution.System - ( Platform(..), OS, Arch ) import Distribution.Simple.Utils - ( currentDir, lowercase ) -import Distribution.Simple.Compiler - ( CompilerInfo(..) ) - import Distribution.Text - ( Text(parse) ) import Distribution.Compat.ReadP as ReadP hiding ( char ) -import Control.Arrow (first) import qualified Distribution.Compat.ReadP as ReadP ( char ) import Distribution.Compat.Semigroup as Semi +import Control.Arrow (first) import Data.Char ( isAlphaNum ) import Data.Maybe ( mapMaybe, maybeToList ) import Data.Map ( Map, fromListWith, toList ) diff --git a/Cabal/Distribution/PackageDescription/Parse.hs b/Cabal/Distribution/PackageDescription/Parse.hs index e1237597f25..88c7a3839cf 100644 --- a/Cabal/Distribution/PackageDescription/Parse.hs +++ b/Cabal/Distribution/PackageDescription/Parse.hs @@ -41,6 +41,19 @@ module Distribution.PackageDescription.Parse ( flagFieldDescrs ) where +import Distribution.ParseUtils hiding (parseFields) +import Distribution.PackageDescription +import Distribution.PackageDescription.Utils +import Distribution.Package +import Distribution.ModuleName +import Distribution.Version +import Distribution.Verbosity +import Distribution.Compiler +import Distribution.PackageDescription.Configuration +import Distribution.Simple.Utils +import Distribution.Text +import Distribution.Compat.ReadP hiding (get) + import Data.Char (isSpace) import Data.Foldable (traverse_) import Data.Maybe (listToMaybe, isJust) @@ -54,30 +67,8 @@ import Control.Arrow (first) import System.Directory (doesFileExist) import qualified Data.ByteString.Lazy.Char8 as BS.Char8 -import Distribution.Text - ( Text(disp, parse), display, simpleParse ) -import Distribution.Compat.ReadP - ((+++), option) import Text.PrettyPrint -import Distribution.ParseUtils hiding (parseFields) -import Distribution.PackageDescription -import Distribution.PackageDescription.Utils - ( cabalBug, userBug ) -import Distribution.Package - ( PackageIdentifier(..), Dependency(..), packageName, packageVersion ) -import Distribution.ModuleName ( ModuleName ) -import Distribution.Version - ( Version(Version), orLaterVersion - , LowerBound(..), asVersionIntervals ) -import Distribution.Verbosity (Verbosity) -import Distribution.Compiler (CompilerFlavor(..)) -import Distribution.PackageDescription.Configuration (parseCondition, freeVars) -import Distribution.Simple.Utils - ( die, dieWithLocation, warn, intercalate, lowercase, cabalVersion - , withFileContents, withUTF8FileContents - , writeFileAtomic, writeUTF8File ) - -- ----------------------------------------------------------------------------- -- The PackageDescription type @@ -902,7 +893,6 @@ parsePackageDescription file = do -- Does the current node specify a test type? hasTestType = testInterface ts' /= testInterface emptyTestSuite - components = condTreeComponents ct -- If the current level of the tree specifies a type, -- then we are done. If not, then one of the conditional -- branches below the current node must specify a type. @@ -910,7 +900,7 @@ parsePackageDescription file = do -- only one need one to specify a type because the -- configure step uses 'mappend' to join together the -- results of flag resolution. - in hasTestType || any checkComponent components + in hasTestType || any checkComponent (condTreeComponents ct) if checkTestType emptyTestSuite flds then do skipField @@ -951,7 +941,6 @@ parsePackageDescription file = do -- Does the current node specify a benchmark type? hasBenchmarkType = benchmarkInterface ts' /= benchmarkInterface emptyBenchmark - components = condTreeComponents ct -- If the current level of the tree specifies a type, -- then we are done. If not, then one of the conditional -- branches below the current node must specify a type. @@ -959,7 +948,7 @@ parsePackageDescription file = do -- only one need one to specify a type because the -- configure step uses 'mappend' to join together the -- results of flag resolution. - in hasBenchmarkType || any checkComponent components + in hasBenchmarkType || any checkComponent (condTreeComponents ct) if checkBenchmarkType emptyBenchmark flds then do skipField diff --git a/Cabal/Distribution/PackageDescription/PrettyPrint.hs b/Cabal/Distribution/PackageDescription/PrettyPrint.hs index 4a1fcd3b56a..3d31b06a70b 100644 --- a/Cabal/Distribution/PackageDescription/PrettyPrint.hs +++ b/Cabal/Distribution/PackageDescription/PrettyPrint.hs @@ -17,25 +17,18 @@ module Distribution.PackageDescription.PrettyPrint ( showGenericPackageDescription, ) where -import Data.Monoid as Mon (Monoid(mempty)) import Distribution.PackageDescription - ( Benchmark(..), BenchmarkInterface(..), benchmarkType - , TestSuite(..), TestSuiteInterface(..), testType - , SourceRepo(..), - customFieldsBI, CondTree(..), Condition(..), cNot, - FlagName(..), ConfVar(..), Executable(..), Library(..), - Flag(..), PackageDescription(..), - GenericPackageDescription(..)) +import Distribution.Simple.Utils +import Distribution.ParseUtils +import Distribution.PackageDescription.Parse +import Distribution.Package +import Distribution.Text + +import Data.Monoid as Mon (Monoid(mempty)) +import Data.Maybe (isJust) import Text.PrettyPrint (hsep, parens, char, nest, empty, isEmpty, ($$), (<+>), colon, (<>), text, vcat, ($+$), Doc, render) -import Distribution.Simple.Utils (writeUTF8File) -import Distribution.ParseUtils (showFreeText, FieldDescr(..), indentWith, ppField, ppFields) -import Distribution.PackageDescription.Parse (pkgDescrFieldDescrs,binfoFieldDescrs,libFieldDescrs, - sourceRepoFieldDescrs,flagFieldDescrs) -import Distribution.Package (Dependency(..)) -import Distribution.Text (Text(..)) -import Data.Maybe (isJust) -- | Recompile with false for regression testing simplifiedPrinting :: Bool diff --git a/Cabal/Distribution/ParseUtils.hs b/Cabal/Distribution/ParseUtils.hs index 7cb2821916a..f0664ce1740 100644 --- a/Cabal/Distribution/ParseUtils.hs +++ b/Cabal/Distribution/ParseUtils.hs @@ -39,21 +39,16 @@ module Distribution.ParseUtils ( UnrecFieldParser, warnUnrec, ignoreUnrec, ) where -import Distribution.Compiler (CompilerFlavor, parseCompilerFlavorCompat) +import Distribution.Compiler import Distribution.License import Distribution.Version - ( Version(..), VersionRange, anyVersion ) -import Distribution.Package ( PackageName(..), Dependency(..) ) -import Distribution.ModuleName (ModuleName) +import Distribution.Package +import Distribution.ModuleName import Distribution.Compat.ReadP as ReadP hiding (get) import Distribution.ReadE import Distribution.Text - ( Text(..) ) import Distribution.Simple.Utils - ( comparing, dropWhileEndLE, intercalate, lowercase - , normaliseLineEndings ) import Language.Haskell.Extension - ( Language, Extension ) import Text.PrettyPrint hiding (braces) import Data.Char (isSpace, toLower, isAlphaNum, isDigit) @@ -657,8 +652,7 @@ parseVersionRangeQ = parseQuoted parse <++ parse parseOptVersion :: ReadP r Version parseOptVersion = parseQuoted ver <++ ver where ver :: ReadP r Version - ver = parse <++ return noVersion - noVersion = Version [] [] + ver = parse <++ return (Version [] []) parseTestedWithQ :: ReadP r (CompilerFlavor,VersionRange) parseTestedWithQ = parseQuoted tw <++ tw diff --git a/Cabal/Distribution/Simple.hs b/Cabal/Distribution/Simple.hs index 22cc8d9c605..ef58a11a877 100644 --- a/Cabal/Distribution/Simple.hs +++ b/Cabal/Distribution/Simple.hs @@ -56,53 +56,35 @@ module Distribution.Simple ( -- local import Distribution.Simple.Compiler hiding (Flag) import Distribution.Simple.UserHooks -import Distribution.Package --must not specify imports, since we're exporting module. -import Distribution.PackageDescription - ( PackageDescription(..), GenericPackageDescription, Executable(..) - , updatePackageDescription, hasLibs - , HookedBuildInfo, emptyHookedBuildInfo ) +import Distribution.Package +import Distribution.PackageDescription hiding (Flag) import Distribution.PackageDescription.Parse - ( readPackageDescription, readHookedBuildInfo ) import Distribution.PackageDescription.Configuration - ( flattenPackageDescription ) import Distribution.Simple.Program - ( defaultProgramConfiguration, builtinPrograms - , restoreProgramConfiguration) import Distribution.Simple.Program.Db -import Distribution.Simple.Program.Find -import Distribution.Simple.Program.Run -import Distribution.Simple.Program.Types -import Distribution.Simple.PreProcess (knownSuffixHandlers, PPSuffixHandler) +import Distribution.Simple.PreProcess import Distribution.Simple.Setup import Distribution.Simple.Command -import Distribution.Simple.Build ( build, repl ) -import Distribution.Simple.SrcDist ( sdist ) +import Distribution.Simple.Build +import Distribution.Simple.SrcDist import Distribution.Simple.Register - ( register, unregister ) import Distribution.Simple.Configure - ( getPersistBuildConfig, maybeGetPersistBuildConfig - , writePersistBuildConfig, checkPersistBuildConfigOutdated - , configure, checkForeignDeps, findDistPrefOrDefault ) - -import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) ) -import Distribution.Simple.Bench (bench) -import Distribution.Simple.BuildPaths ( srcPref) -import Distribution.Simple.Test (test) -import Distribution.Simple.Install (install) -import Distribution.Simple.Haddock (haddock, hscolour) + +import Distribution.Simple.LocalBuildInfo +import Distribution.Simple.Bench +import Distribution.Simple.BuildPaths +import Distribution.Simple.Test +import Distribution.Simple.Install +import Distribution.Simple.Haddock import Distribution.Simple.Utils - (die, notice, info, warn, setupMessage, chattyTry, - defaultPackageDesc, defaultHookedPackageDesc, - cabalVersion, topHandler ) import Distribution.Utils.NubList import Distribution.Verbosity import Language.Haskell.Extension import Distribution.Version import Distribution.License import Distribution.Text - ( display ) -- Base import System.Environment(getArgs, getProgName) @@ -114,7 +96,7 @@ import Distribution.Compat.Environment (getEnvironment) import Control.Monad (when) import Data.Foldable (traverse_) -import Data.List (intercalate, unionBy, nub, (\\)) +import Data.List (unionBy, nub, (\\)) -- | A simple implementation of @main@ for a Cabal setup script. -- It reads the package description file using IO, and performs the @@ -707,6 +689,5 @@ defaultRegHook :: PackageDescription -> LocalBuildInfo defaultRegHook pkg_descr localbuildinfo _ flags = if hasLibs pkg_descr then register pkg_descr localbuildinfo flags - else setupMessage verbosity + else setupMessage (fromFlag (regVerbosity flags)) "Package contains no library to register:" (packageId pkg_descr) - where verbosity = fromFlag (regVerbosity flags) diff --git a/Cabal/Distribution/Simple/Bench.hs b/Cabal/Distribution/Simple/Bench.hs index 5574330cdae..179f37f1f4c 100644 --- a/Cabal/Distribution/Simple/Bench.hs +++ b/Cabal/Distribution/Simple/Bench.hs @@ -16,17 +16,13 @@ module Distribution.Simple.Bench ) where import qualified Distribution.PackageDescription as PD - ( PackageDescription(..), BuildInfo(buildable) - , Benchmark(..), BenchmarkInterface(..), benchmarkType, hasBenchmarks ) -import Distribution.Simple.BuildPaths ( exeExtension ) -import Distribution.Simple.Compiler ( compilerInfo ) +import Distribution.Simple.BuildPaths +import Distribution.Simple.Compiler import Distribution.Simple.InstallDirs - ( fromPathTemplate, initialPathTemplateEnv, PathTemplateVariable(..) - , substPathTemplate , toPathTemplate, PathTemplate ) import qualified Distribution.Simple.LocalBuildInfo as LBI -import Distribution.Simple.Setup ( BenchmarkFlags(..), fromFlag ) -import Distribution.Simple.UserHooks ( Args ) -import Distribution.Simple.Utils ( die, notice, rawSystemExitCode ) +import Distribution.Simple.Setup +import Distribution.Simple.UserHooks +import Distribution.Simple.Utils import Distribution.Text import Control.Monad ( when, unless, forM ) diff --git a/Cabal/Distribution/Simple/Build.hs b/Cabal/Distribution/Simple/Build.hs index 1ab823710d3..590e576ab03 100644 --- a/Cabal/Distribution/Simple/Build.hs +++ b/Cabal/Distribution/Simple/Build.hs @@ -23,6 +23,7 @@ module Distribution.Simple.Build ( writeAutogenFiles, ) where +import Distribution.Package import qualified Distribution.Simple.GHC as GHC import qualified Distribution.Simple.GHCJS as GHCJS import qualified Distribution.Simple.JHC as JHC @@ -33,57 +34,32 @@ import qualified Distribution.Simple.HaskellSuite as HaskellSuite import qualified Distribution.Simple.Build.Macros as Build.Macros import qualified Distribution.Simple.Build.PathsModule as Build.PathsModule -import Distribution.Package - ( Package(..), PackageName(..), PackageIdentifier(..) - , Dependency(..), thisPackageVersion, packageName - , ComponentId(..), ComponentId(..) ) -import Distribution.Simple.Compiler - ( Compiler, CompilerFlavor(..), compilerFlavor - , PackageDB(..), PackageDBStack ) -import Distribution.PackageDescription - ( PackageDescription(..), BuildInfo(..), Library(..), Executable(..) - , TestSuite(..), TestSuiteInterface(..), Benchmark(..) - , BenchmarkInterface(..), allBuildInfo, defaultRenaming ) +import Distribution.Simple.Compiler hiding (Flag) +import Distribution.PackageDescription hiding (Flag) import qualified Distribution.InstalledPackageInfo as IPI import qualified Distribution.ModuleName as ModuleName import Distribution.ModuleName (ModuleName) import Distribution.Simple.Setup - ( Flag(..), BuildFlags(..), ReplFlags(..), fromFlag ) import Distribution.Simple.BuildTarget - ( BuildTarget(..), readBuildTargets ) import Distribution.Simple.PreProcess - ( preprocessComponent, preprocessExtras, PPSuffixHandler ) import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(compiler, buildDir, withPackageDB, withPrograms) - , Component(..), componentName, getComponent, componentBuildInfo - , ComponentLocalBuildInfo(..), pkgEnabledComponents - , withComponentsInBuildOrder, componentsInBuildOrder - , ComponentName(..), showComponentName - , ComponentDisabledReason(..), componentDisabledReason ) import Distribution.Simple.Program.Types import Distribution.Simple.Program.Db import Distribution.Simple.BuildPaths - ( autogenModulesDir, autogenModuleName, cppHeaderName, exeExtension ) import Distribution.Simple.Register - ( registerPackage, inplaceInstalledPackageInfo - , doesPackageDBExist, deletePackageDB, createPackageDB ) -import Distribution.Simple.Test.LibV09 ( stubFilePath, stubName ) +import Distribution.Simple.Test.LibV09 import Distribution.Simple.Utils - ( createDirectoryIfMissingVerbose, rewriteFile - , die, info, debug, warn, setupMessage ) import Distribution.Verbosity - ( Verbosity ) import Distribution.Text - ( display ) import qualified Data.Map as Map import qualified Data.Set as Set import Data.Either ( partitionEithers ) import Data.List - ( intersect, intercalate ) + ( intersect ) import Control.Monad ( when, unless, forM_ ) import System.FilePath @@ -206,7 +182,7 @@ buildComponent verbosity numJobs pkg_descr lbi suffixes pwd <- getCurrentDirectory let -- The in place registration uses the "-inplace" suffix, not an ABI hash installedPkgInfo = inplaceInstalledPackageInfo pwd distPref pkg_descr - (IPI.AbiHash "") lib' lbi clbi + (AbiHash "") lib' lbi clbi registerPackage verbosity (compiler lbi) (withPrograms lbi) False (withPackageDB lbi) installedPkgInfo @@ -417,7 +393,7 @@ testSuiteLibV09AsLibAndExe pkg_descr , testSuites = [] , library = Just lib } - ipi = inplaceInstalledPackageInfo pwd distPref pkg (IPI.AbiHash "") lib lbi libClbi + ipi = inplaceInstalledPackageInfo pwd distPref pkg (AbiHash "") lib lbi libClbi testDir = buildDir lbi stubName test stubName test ++ "-tmp" testLibDep = thisPackageVersion $ package pkg diff --git a/Cabal/Distribution/Simple/Build/PathsModule.hs b/Cabal/Distribution/Simple/Build/PathsModule.hs index 2a229582d4e..c70f34ad1a9 100644 --- a/Cabal/Distribution/Simple/Build/PathsModule.hs +++ b/Cabal/Distribution/Simple/Build/PathsModule.hs @@ -19,22 +19,14 @@ module Distribution.Simple.Build.PathsModule ( ) where import Distribution.System - ( OS(Windows), buildOS, Arch(..), buildArch ) import Distribution.Simple.Compiler - ( CompilerFlavor(..), compilerFlavor, compilerVersion ) import Distribution.Package - ( packageId, packageName, packageVersion ) import Distribution.PackageDescription - ( PackageDescription(..), hasLibs ) import Distribution.Simple.LocalBuildInfo import Distribution.Simple.BuildPaths - ( autogenModuleName ) import Distribution.Simple.Utils - ( shortRelativePath ) import Distribution.Text - ( display ) import Distribution.Version - ( Version(..), orLaterVersion, withinRange ) import System.FilePath ( pathSeparator ) diff --git a/Cabal/Distribution/Simple/BuildPaths.hs b/Cabal/Distribution/Simple/BuildPaths.hs index c5dd1ef6f37..847948be885 100644 --- a/Cabal/Distribution/Simple/BuildPaths.hs +++ b/Cabal/Distribution/Simple/BuildPaths.hs @@ -31,21 +31,16 @@ module Distribution.Simple.BuildPaths ( ) where -import System.FilePath ((), (<.>)) - import Distribution.Package - ( packageName, getHSLibraryName, ComponentId ) -import Distribution.ModuleName (ModuleName) -import qualified Distribution.ModuleName as ModuleName +import Distribution.ModuleName as ModuleName import Distribution.Compiler - ( CompilerId(..) ) -import Distribution.PackageDescription (PackageDescription) +import Distribution.PackageDescription import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(buildDir) ) -import Distribution.Simple.Setup (defaultDistPref) +import Distribution.Simple.Setup import Distribution.Text - ( display ) -import Distribution.System (OS(..), buildOS) +import Distribution.System + +import System.FilePath ((), (<.>)) -- --------------------------------------------------------------------------- -- Build directories and files diff --git a/Cabal/Distribution/Simple/BuildTarget.hs b/Cabal/Distribution/Simple/BuildTarget.hs index f68f166d1c0..704ba1ba7e2 100644 --- a/Cabal/Distribution/Simple/BuildTarget.hs +++ b/Cabal/Distribution/Simple/BuildTarget.hs @@ -32,40 +32,27 @@ module Distribution.Simple.BuildTarget ( ) where import Distribution.Package - ( Package(..), PackageId, packageName ) - import Distribution.PackageDescription - ( PackageDescription - , Executable(..) - , TestSuite(..), TestSuiteInterface(..), testModules - , Benchmark(..), BenchmarkInterface(..), benchmarkModules - , BuildInfo(..), libModules, exeModules ) import Distribution.ModuleName - ( ModuleName, toFilePath ) import Distribution.Simple.LocalBuildInfo - ( Component(..), ComponentName(..) - , pkgComponents, componentName, componentBuildInfo ) - import Distribution.Text - ( display ) import Distribution.Simple.Utils - ( die, lowercase, equating ) + +import Distribution.Compat.Binary (Binary) +import qualified Distribution.Compat.ReadP as Parse +import Distribution.Compat.ReadP + ( (+++), (<++) ) import Data.List - ( nub, stripPrefix, sortBy, groupBy, partition, intercalate ) -import Data.Ord + ( nub, stripPrefix, sortBy, groupBy, partition ) import Data.Maybe ( listToMaybe, catMaybes ) import Data.Either ( partitionEithers ) -import Distribution.Compat.Binary (Binary) import GHC.Generics (Generic) import qualified Data.Map as Map import Control.Monad import Control.Applicative as AP (Alternative(..), Applicative(..)) -import qualified Distribution.Compat.ReadP as Parse -import Distribution.Compat.ReadP - ( (+++), (<++) ) import Data.Char ( isSpace, isAlphaNum ) import System.FilePath as FilePath @@ -235,11 +222,11 @@ reportUserBuildTargetProblems problems = do ++ " - build foo:Data/Foo.hsc -- file qualified by component" showUserBuildTarget :: UserBuildTarget -> String -showUserBuildTarget = intercalate ":" . components +showUserBuildTarget = intercalate ":" . getComponents where - components (UserBuildTargetSingle s1) = [s1] - components (UserBuildTargetDouble s1 s2) = [s1,s2] - components (UserBuildTargetTriple s1 s2 s3) = [s1,s2,s3] + getComponents (UserBuildTargetSingle s1) = [s1] + getComponents (UserBuildTargetDouble s1 s2) = [s1,s2] + getComponents (UserBuildTargetTriple s1 s2 s3) = [s1,s2,s3] showBuildTarget :: QualLevel -> PackageId -> BuildTarget -> String showBuildTarget ql pkgid bt = diff --git a/Cabal/Distribution/Simple/Command.hs b/Cabal/Distribution/Simple/Command.hs index 185f7d23e5b..deb7e93b841 100644 --- a/Cabal/Distribution/Simple/Command.hs +++ b/Cabal/Distribution/Simple/Command.hs @@ -65,17 +65,17 @@ module Distribution.Simple.Command ( ) where +import qualified Distribution.GetOpt as GetOpt +import Distribution.Text +import Distribution.ParseUtils +import Distribution.ReadE +import Distribution.Simple.Utils + import Control.Monad import Data.Char (isAlpha, toLower) import Data.List (sortBy) import Data.Maybe import Data.Monoid as Mon -import qualified Distribution.GetOpt as GetOpt -import Distribution.Text - ( Text(disp, parse) ) -import Distribution.ParseUtils -import Distribution.ReadE -import Distribution.Simple.Utils (die, intercalate) import Text.PrettyPrint ( punctuate, cat, comma, text ) import Text.PrettyPrint as PP ( empty ) diff --git a/Cabal/Distribution/Simple/Compiler.hs b/Cabal/Distribution/Simple/Compiler.hs index 89f8f055f01..eca154fd243 100644 --- a/Cabal/Distribution/Simple/Compiler.hs +++ b/Cabal/Distribution/Simple/Compiler.hs @@ -64,13 +64,13 @@ module Distribution.Simple.Compiler ( ) where import Distribution.Compiler -import Distribution.Version (Version(..)) -import Distribution.Text (display) -import Language.Haskell.Extension (Language(Haskell98), Extension) -import Distribution.Simple.Utils (lowercase) +import Distribution.Version +import Distribution.Text +import Language.Haskell.Extension +import Distribution.Simple.Utils +import Distribution.Compat.Binary import Control.Monad (liftM) -import Distribution.Compat.Binary (Binary) import Data.List (nub) import qualified Data.Map as M (Map, lookup) import Data.Maybe (catMaybes, isNothing, listToMaybe) diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs index 86ac7576958..70a46887444 100644 --- a/Cabal/Distribution/Simple/Configure.hs +++ b/Cabal/Distribution/Simple/Configure.hs @@ -51,72 +51,27 @@ module Distribution.Simple.Configure (configure, where import Distribution.Compiler - ( CompilerId(..) ) import Distribution.Utils.NubList -import Distribution.Simple.Compiler - ( CompilerFlavor(..), Compiler(..), compilerFlavor, compilerVersion - , compilerInfo, ProfDetailLevel(..), knownProfDetailLevels - , showCompilerId, unsupportedLanguages, unsupportedExtensions - , PackageDB(..), PackageDBStack, reexportedModulesSupported - , packageKeySupported, renamingPackageFlagsSupported - , unifiedIPIDRequired ) -import Distribution.Simple.PreProcess ( platformDefines ) +import Distribution.Simple.Compiler hiding (Flag) +import Distribution.Simple.PreProcess import Distribution.Package - ( PackageName(PackageName), PackageIdentifier(..), PackageId - , packageName, packageVersion, Package(..) - , Dependency(Dependency), simplifyDependency - , ComponentId(..), thisPackageVersion, ComponentId(..) ) import qualified Distribution.InstalledPackageInfo as Installed import Distribution.InstalledPackageInfo (InstalledPackageInfo, emptyInstalledPackageInfo) import qualified Distribution.Simple.PackageIndex as PackageIndex import Distribution.Simple.PackageIndex (InstalledPackageIndex) -import Distribution.PackageDescription as PD - ( PackageDescription(..), specVersion, GenericPackageDescription(..) - , Library(..), hasLibs, Executable(..), BuildInfo(..), allExtensions - , HookedBuildInfo, updatePackageDescription, allBuildInfo - , Flag(flagName), FlagName(..), TestSuite(..), Benchmark(..) - , ModuleReexport(..) , defaultRenaming, FlagAssignment ) +import Distribution.PackageDescription as PD hiding (Flag) import Distribution.ModuleName - ( ModuleName ) import Distribution.PackageDescription.Configuration - ( finalizePackageDescription, mapTreeData ) -import Distribution.PackageDescription.Check - ( PackageCheck(..), checkPackage, checkPackageFiles ) +import Distribution.PackageDescription.Check hiding (doesFileExist) import Distribution.Simple.Program - ( Program(..), ProgramLocation(..), ConfiguredProgram(..) - , ProgramConfiguration, defaultProgramConfiguration - , ProgramSearchPathEntry(..), getProgramSearchPath, setProgramSearchPath - , configureAllKnownPrograms, knownPrograms, lookupKnownProgram - , userSpecifyArgss, userSpecifyPaths - , lookupProgram, requireProgram, requireProgramVersion - , pkgConfigProgram, gccProgram, rawSystemProgramStdoutConf ) import Distribution.Simple.Setup as Setup - ( ConfigFlags(..), CopyDest(..), Flag(..), defaultDistPref - , fromFlag, fromFlagOrDefault, flagToMaybe, toFlag ) -import Distribution.Simple.InstallDirs - ( InstallDirs(..), defaultInstallDirs, combineInstallDirs ) +import qualified Distribution.Simple.InstallDirs as InstallDirs import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), Component(..), ComponentLocalBuildInfo(..) - , absoluteInstallDirs, prefixRelativeInstallDirs - , ComponentName(..), showComponentName, pkgEnabledComponents - , componentBuildInfo, componentName, checkComponentsCyclic - , lookupComponent ) import Distribution.Simple.BuildPaths - ( autogenModulesDir ) import Distribution.Simple.Utils - ( die, warn, info, setupMessage - , createDirectoryIfMissingVerbose, moreRecentFile - , intercalate, cabalVersion - , writeFileAtomic - , withTempFile ) import Distribution.System - ( OS(..), buildOS, Platform (..), buildPlatform ) import Distribution.Version - ( Version(..), anyVersion, orLaterVersion, withinRange, isAnyVersion ) import Distribution.Verbosity - ( Verbosity, lessVerbose ) -import Distribution.Simple.InstallDirs - ( fromPathTemplate, substPathTemplate, toPathTemplate, packageTemplateEnv ) import qualified Distribution.Simple.GHC as GHC import qualified Distribution.Simple.GHCJS as GHCJS @@ -548,11 +503,11 @@ configure (pkg_descr0, pbi) cfg = do buildComponents <- case mkComponentsGraph pkg_descr internalPkgDeps of Left componentCycle -> reportComponentCycle componentCycle - Right components -> + Right comps -> mkComponentsLocalBuildInfo cfg comp packageDependsIndex pkg_descr internalPkgDeps externalPkgDeps holeDeps (Map.fromList hole_insts) - components (configConfigurationsFlags cfg) + comps (configConfigurationsFlags cfg) split_objs <- if not (fromFlag $ configSplitObjs cfg) @@ -1515,7 +1470,7 @@ mkComponentsLocalBuildInfo cfg comp installedPackages pkg_descr -- Hack to reuse install dirs machinery -- NB: no real IPID available at this point let env = packageTemplateEnv (package pkg_descr) (ComponentId "") - str = fromPathTemplate (substPathTemplate env (toPathTemplate lib_hash0)) + str = fromPathTemplate (InstallDirs.substPathTemplate env (toPathTemplate lib_hash0)) in return (ComponentId str) _ -> computeComponentId pkg_descr CLibName (getDeps CLibName) flagAssignment diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs index f3a32fd85c5..b66e8469805 100644 --- a/Cabal/Distribution/Simple/GHC.hs +++ b/Cabal/Distribution/Simple/GHC.hs @@ -58,54 +58,31 @@ import qualified Distribution.Simple.GHC.IPI642 as IPI642 import qualified Distribution.Simple.GHC.Internal as Internal import Distribution.Simple.GHC.ImplInfo import Distribution.PackageDescription as PD - ( PackageDescription(..), BuildInfo(..), Executable(..), Library(..) - , allExtensions, libModules, exeModules - , hcOptions, hcSharedOptions, hcProfOptions ) -import Distribution.InstalledPackageInfo - ( InstalledPackageInfo ) +import Distribution.InstalledPackageInfo (InstalledPackageInfo) import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo - ( InstalledPackageInfo(..) ) import Distribution.Simple.PackageIndex (InstalledPackageIndex) import qualified Distribution.Simple.PackageIndex as PackageIndex import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), ComponentLocalBuildInfo(..) - , absoluteInstallDirs, depLibraryPaths ) import qualified Distribution.Simple.Hpc as Hpc -import Distribution.Simple.InstallDirs hiding ( absoluteInstallDirs ) import Distribution.Simple.BuildPaths import Distribution.Simple.Utils import Distribution.Package - ( PackageName(..) ) import qualified Distribution.ModuleName as ModuleName import Distribution.Simple.Program - ( Program(..), ConfiguredProgram(..), ProgramConfiguration - , ProgramSearchPath - , rawSystemProgramStdout, rawSystemProgramStdoutConf - , getProgramInvocationOutput, requireProgramVersion, requireProgram - , userMaybeSpecifyPath, programPath, lookupProgram, addKnownProgram - , ghcProgram, ghcPkgProgram, haddockProgram, hsc2hsProgram, ldProgram ) import qualified Distribution.Simple.Program.HcPkg as HcPkg import qualified Distribution.Simple.Program.Ar as Ar import qualified Distribution.Simple.Program.Ld as Ld import qualified Distribution.Simple.Program.Strip as Strip import Distribution.Simple.Program.GHC import Distribution.Simple.Setup - ( toFlag, fromFlag, fromFlagOrDefault, configCoverage, configDistPref ) import qualified Distribution.Simple.Setup as Cabal - ( Flag(..) ) -import Distribution.Simple.Compiler - ( CompilerFlavor(..), CompilerId(..), Compiler(..), compilerVersion - , PackageDB(..), PackageDBStack, AbiTag(..) ) +import Distribution.Simple.Compiler hiding (Flag) import Distribution.Version - ( Version(..), anyVersion, orLaterVersion ) import Distribution.System - ( Platform(..), OS(..) ) import Distribution.Verbosity import Distribution.Text - ( display ) import Distribution.Utils.NubList - ( NubListR, overNubListR, toNubListR ) -import Language.Haskell.Extension (Extension(..), KnownExtension(..)) +import Language.Haskell.Extension import Control.Monad ( unless, when ) import Data.Char ( isDigit, isSpace ) diff --git a/Cabal/Distribution/Simple/GHC/IPI641.hs b/Cabal/Distribution/Simple/GHC/IPI641.hs index c18ab50bfe6..bf9ab3172bf 100644 --- a/Cabal/Distribution/Simple/GHC/IPI641.hs +++ b/Cabal/Distribution/Simple/GHC/IPI641.hs @@ -15,11 +15,8 @@ module Distribution.Simple.GHC.IPI641 ( import qualified Distribution.InstalledPackageInfo as Current import qualified Distribution.Package as Current hiding (installedComponentId) -import Distribution.Text (display) - -import Distribution.Simple.GHC.IPI642 - ( PackageIdentifier, convertPackageId - , License, convertLicense, convertModuleName ) +import Distribution.Text +import Distribution.Simple.GHC.IPIConvert -- | This is the InstalledPackageInfo type used by ghc-6.4 and 6.4.1. -- @@ -85,7 +82,7 @@ toCurrent ipi@InstalledPackageInfo{} = Current.abiHash = Current.AbiHash "", Current.exposed = exposed ipi, Current.exposedModules = map (mkExposedModule . convertModuleName) (exposedModules ipi), - Current.instantiatedWith = [], + Current.installedInstantiatedWith = [], Current.hiddenModules = map convertModuleName (hiddenModules ipi), Current.trusted = Current.trusted Current.emptyInstalledPackageInfo, Current.importDirs = importDirs ipi, diff --git a/Cabal/Distribution/Simple/GHC/IPI642.hs b/Cabal/Distribution/Simple/GHC/IPI642.hs index eed9a8dfc1f..3867205e289 100644 --- a/Cabal/Distribution/Simple/GHC/IPI642.hs +++ b/Cabal/Distribution/Simple/GHC/IPI642.hs @@ -11,22 +11,13 @@ module Distribution.Simple.GHC.IPI642 ( InstalledPackageInfo(..), toCurrent, - - -- Don't use these, they're only for conversion purposes - PackageIdentifier, convertPackageId, - License, convertLicense, - convertModuleName ) where import qualified Distribution.InstalledPackageInfo as Current import qualified Distribution.Package as Current hiding (installedComponentId) -import qualified Distribution.License as Current - -import Distribution.Version (Version) -import Distribution.ModuleName (ModuleName) -import Distribution.Text (simpleParse,display) +import Distribution.Simple.GHC.IPIConvert -import Data.Maybe +import Distribution.Text -- | This is the InstalledPackageInfo type used by ghc-6.4.2 and later. -- @@ -70,35 +61,9 @@ data InstalledPackageInfo = InstalledPackageInfo { } deriving Read -data PackageIdentifier = PackageIdentifier { - pkgName :: String, - pkgVersion :: Version - } - deriving Read - -data License = GPL | LGPL | BSD3 | BSD4 - | PublicDomain | AllRightsReserved | OtherLicense - deriving Read - -convertPackageId :: PackageIdentifier -> Current.PackageIdentifier -convertPackageId PackageIdentifier { pkgName = n, pkgVersion = v } = - Current.PackageIdentifier (Current.PackageName n) v - mkComponentId :: Current.PackageIdentifier -> Current.ComponentId mkComponentId = Current.ComponentId . display -convertModuleName :: String -> ModuleName -convertModuleName s = fromJust $ simpleParse s - -convertLicense :: License -> Current.License -convertLicense GPL = Current.GPL Nothing -convertLicense LGPL = Current.LGPL Nothing -convertLicense BSD3 = Current.BSD3 -convertLicense BSD4 = Current.BSD4 -convertLicense PublicDomain = Current.PublicDomain -convertLicense AllRightsReserved = Current.AllRightsReserved -convertLicense OtherLicense = Current.OtherLicense - toCurrent :: InstalledPackageInfo -> Current.InstalledPackageInfo toCurrent ipi@InstalledPackageInfo{} = let pid = convertPackageId (package ipi) @@ -121,7 +86,7 @@ toCurrent ipi@InstalledPackageInfo{} = Current.exposed = exposed ipi, Current.exposedModules = map (mkExposedModule . convertModuleName) (exposedModules ipi), Current.hiddenModules = map convertModuleName (hiddenModules ipi), - Current.instantiatedWith = [], + Current.installedInstantiatedWith = [], Current.trusted = Current.trusted Current.emptyInstalledPackageInfo, Current.importDirs = importDirs ipi, Current.libraryDirs = libraryDirs ipi, diff --git a/Cabal/Distribution/Simple/GHC/IPIConvert.hs b/Cabal/Distribution/Simple/GHC/IPIConvert.hs new file mode 100644 index 00000000000..e121d779fae --- /dev/null +++ b/Cabal/Distribution/Simple/GHC/IPIConvert.hs @@ -0,0 +1,51 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Distribution.Simple.GHC.IPI642 +-- Copyright : (c) The University of Glasgow 2004 +-- License : BSD3 +-- +-- Maintainer : cabal-devel@haskell.org +-- Portability : portable +-- +-- Helper functions for 'Distribution.Simple.GHC.IPI642' and +-- 'Distribution.Simple.GHC.IPI641' +module Distribution.Simple.GHC.IPIConvert ( + PackageIdentifier, convertPackageId, + License, convertLicense, + convertModuleName + ) where + +import qualified Distribution.Package as Current hiding (installedComponentId) +import qualified Distribution.License as Current + +import Distribution.Version +import Distribution.ModuleName +import Distribution.Text + +import Data.Maybe + +data PackageIdentifier = PackageIdentifier { + pkgName :: String, + pkgVersion :: Version + } + deriving Read + +convertPackageId :: PackageIdentifier -> Current.PackageIdentifier +convertPackageId PackageIdentifier { pkgName = n, pkgVersion = v } = + Current.PackageIdentifier (Current.PackageName n) v + +data License = GPL | LGPL | BSD3 | BSD4 + | PublicDomain | AllRightsReserved | OtherLicense + deriving Read + +convertModuleName :: String -> ModuleName +convertModuleName s = fromJust $ simpleParse s + +convertLicense :: License -> Current.License +convertLicense GPL = Current.GPL Nothing +convertLicense LGPL = Current.LGPL Nothing +convertLicense BSD3 = Current.BSD3 +convertLicense BSD4 = Current.BSD4 +convertLicense PublicDomain = Current.PublicDomain +convertLicense AllRightsReserved = Current.AllRightsReserved +convertLicense OtherLicense = Current.OtherLicense diff --git a/Cabal/Distribution/Simple/GHC/ImplInfo.hs b/Cabal/Distribution/Simple/GHC/ImplInfo.hs index 46e1c43cc12..96c3064ce08 100644 --- a/Cabal/Distribution/Simple/GHC/ImplInfo.hs +++ b/Cabal/Distribution/Simple/GHC/ImplInfo.hs @@ -15,9 +15,7 @@ module Distribution.Simple.GHC.ImplInfo ( ) where import Distribution.Simple.Compiler - ( Compiler(..), CompilerFlavor(..) - , compilerFlavor, compilerVersion, compilerCompatVersion ) -import Distribution.Version ( Version(..) ) +import Distribution.Version {- | Information about features and quirks of a GHC-based implementation. diff --git a/Cabal/Distribution/Simple/GHC/Internal.hs b/Cabal/Distribution/Simple/GHC/Internal.hs index 7957284a7c6..e52f163556d 100644 --- a/Cabal/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/Distribution/Simple/GHC/Internal.hs @@ -30,43 +30,26 @@ module Distribution.Simple.GHC.Internal ( showOsString, ) where -import Distribution.Simple.GHC.ImplInfo ( GhcImplInfo (..) ) +import Distribution.Simple.GHC.ImplInfo import Distribution.Package - ( PackageId, ComponentId, getHSLibraryName ) import Distribution.InstalledPackageInfo - ( InstalledPackageInfo ) import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo - ( InstalledPackageInfo(..) ) -import Distribution.PackageDescription as PD - ( BuildInfo(..), Library(..), libModules - , hcOptions, usedExtensions, ModuleRenaming, lookupRenaming ) -import Distribution.Compat.Exception ( catchExit, catchIO ) -import Distribution.Lex (tokenizeQuotedWords) -import Distribution.Simple.Compiler - ( CompilerFlavor(..), Compiler(..), DebugInfoLevel(..) - , OptimisationLevel(..), ProfDetailLevel(..) ) +import Distribution.PackageDescription as PD hiding (Flag) +import Distribution.Compat.Exception +import Distribution.Lex +import Distribution.Simple.Compiler hiding (Flag) import Distribution.Simple.Program.GHC import Distribution.Simple.Setup - ( Flag, toFlag ) import qualified Distribution.ModuleName as ModuleName import Distribution.Simple.Program - ( Program(..), ConfiguredProgram(..), ProgramConfiguration - , ProgramLocation(..), ProgramSearchPath, ProgramSearchPathEntry(..) - , rawSystemProgram, rawSystemProgramStdout, programPath - , addKnownProgram, arProgram, ldProgram, gccProgram, stripProgram - , getProgramOutput ) -import Distribution.Simple.Program.Types ( suppressOverrideArgs ) import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), ComponentLocalBuildInfo(..) ) import Distribution.Simple.Utils import Distribution.Simple.BuildPaths import Distribution.System - ( Arch(..), buildOS, OS(..), Platform, platformFromTriple ) import Distribution.Text ( display, simpleParse ) import Distribution.Utils.NubList ( toNubListR ) import Distribution.Verbosity import Language.Haskell.Extension - ( Language(..), Extension(..), KnownExtension(..) ) import qualified Data.Map as M import Data.Char ( isSpace ) diff --git a/Cabal/Distribution/Simple/Haddock.hs b/Cabal/Distribution/Simple/Haddock.hs index 353f1fb124c..fd2a6ed3ebf 100644 --- a/Cabal/Distribution/Simple/Haddock.hs +++ b/Cabal/Distribution/Simple/Haddock.hs @@ -26,60 +26,24 @@ import qualified Distribution.Simple.GHCJS as GHCJS -- local import Distribution.Compat.Semigroup as Semi import Distribution.Package - ( PackageIdentifier(..) - , Package(..) - , PackageName(..), packageName, ComponentId(..) ) import qualified Distribution.ModuleName as ModuleName -import Distribution.PackageDescription as PD - ( PackageDescription(..), BuildInfo(..), usedExtensions - , hcSharedOptions - , Library(..), hasLibs, Executable(..) - , TestSuite(..), TestSuiteInterface(..) - , Benchmark(..), BenchmarkInterface(..) ) -import Distribution.Simple.Compiler - ( Compiler, compilerInfo, CompilerFlavor(..) - , compilerFlavor, compilerCompatVersion ) +import Distribution.PackageDescription as PD hiding (Flag) +import Distribution.Simple.Compiler hiding (Flag) import Distribution.Simple.Program.GHC - ( GhcOptions(..), GhcDynLinkMode(..), renderGhcOptions ) import Distribution.Simple.Program - ( ConfiguredProgram(..), lookupProgramVersion, requireProgramVersion - , rawSystemProgram, rawSystemProgramStdout - , hscolourProgram, haddockProgram ) import Distribution.Simple.PreProcess - ( PPSuffixHandler, preprocessComponent) import Distribution.Simple.Setup - ( defaultHscolourFlags - , Flag(..), toFlag, flagToMaybe, flagToList, fromFlag - , fromFlagOrDefault, HaddockFlags(..), HscolourFlags(..) ) -import Distribution.Simple.Build (initialBuildSteps) +import Distribution.Simple.Build import Distribution.Simple.InstallDirs - ( InstallDirs(..) - , PathTemplateEnv, PathTemplate, PathTemplateVariable(..) - , toPathTemplate, fromPathTemplate - , substPathTemplate, initialPathTemplateEnv ) -import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), Component(..), ComponentLocalBuildInfo(..) - , withAllComponentsInBuildOrder ) +import Distribution.Simple.LocalBuildInfo hiding (substPathTemplate) import Distribution.Simple.BuildPaths - ( haddockName, hscolourPref, autogenModulesDir) -import Distribution.Simple.PackageIndex (dependencyClosure) import qualified Distribution.Simple.PackageIndex as PackageIndex import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo - ( InstalledPackageInfo(..) ) -import Distribution.InstalledPackageInfo - ( InstalledPackageInfo ) +import Distribution.InstalledPackageInfo ( InstalledPackageInfo ) import Distribution.Simple.Utils - ( die, copyFileTo, warn, notice, intercalate, setupMessage - , createDirectoryIfMissingVerbose - , TempFileOptions(..), defaultTempFileOptions - , withTempFileEx, copyFileVerbose - , withTempDirectoryEx, matchFileGlob - , findFileWithExtension, findFile ) import Distribution.Text - ( display, simpleParse ) import Distribution.Utils.NubList - ( toNubListR ) - +import Distribution.Version import Distribution.Verbosity import Language.Haskell.Extension @@ -93,7 +57,6 @@ import System.Directory (doesFileExist) import System.FilePath ( (), (<.>) , normalise, splitPath, joinPath, isAbsolute ) import System.IO (hClose, hPutStrLn, hSetEncoding, utf8) -import Distribution.Version -- ------------------------------------------------------------------------------ -- Types @@ -631,7 +594,7 @@ haddockPackageFlags :: LocalBuildInfo haddockPackageFlags lbi clbi htmlTemplate = do let allPkgs = installedPkgs lbi directDeps = map fst (componentPackageDeps clbi) - transitiveDeps <- case dependencyClosure allPkgs directDeps of + transitiveDeps <- case PackageIndex.dependencyClosure allPkgs directDeps of Left x -> return x Right inf -> die $ "internal error when calculating transitive " ++ "package dependencies.\nDebug info: " ++ show inf diff --git a/Cabal/Distribution/Simple/HaskellSuite.hs b/Cabal/Distribution/Simple/HaskellSuite.hs index 25d50edc849..7301ccb925b 100644 --- a/Cabal/Distribution/Simple/HaskellSuite.hs +++ b/Cabal/Distribution/Simple/HaskellSuite.hs @@ -20,7 +20,6 @@ import Distribution.System (Platform) import Distribution.Compat.Exception import Language.Haskell.Extension import Distribution.Simple.Program.Builtin - (haskellSuiteProgram, haskellSuitePkgProgram) configure :: Verbosity -> Maybe FilePath -> Maybe FilePath diff --git a/Cabal/Distribution/Simple/InstallDirs.hs b/Cabal/Distribution/Simple/InstallDirs.hs index 41919029382..7fa9dba77d3 100644 --- a/Cabal/Distribution/Simple/InstallDirs.hs +++ b/Cabal/Distribution/Simple/InstallDirs.hs @@ -47,6 +47,11 @@ module Distribution.Simple.InstallDirs ( import Distribution.Compat.Binary (Binary) import Distribution.Compat.Semigroup as Semi +import Distribution.Package +import Distribution.System +import Distribution.Compiler +import Distribution.Text + import Data.List (isPrefixOf) import Data.Maybe (fromMaybe) import GHC.Generics (Generic) @@ -54,15 +59,6 @@ import System.Directory (getAppUserDataDirectory) import System.FilePath ((), isPathSeparator, pathSeparator) import System.FilePath (dropDrive) -import Distribution.Package - ( PackageIdentifier, packageName, packageVersion, ComponentId ) -import Distribution.System - ( OS(..), buildOS, Platform(..) ) -import Distribution.Compiler - ( AbiTag(..), abiTagString, CompilerInfo(..), CompilerFlavor(..) ) -import Distribution.Text - ( display ) - #if mingw32_HOST_OS import Foreign import Foreign.C diff --git a/Cabal/Distribution/Simple/JHC.hs b/Cabal/Distribution/Simple/JHC.hs index bb29109a3c0..40541bc3267 100644 --- a/Cabal/Distribution/Simple/JHC.hs +++ b/Cabal/Distribution/Simple/JHC.hs @@ -16,40 +16,23 @@ module Distribution.Simple.JHC ( installLib, installExe ) where -import Distribution.PackageDescription as PD - ( PackageDescription(..), BuildInfo(..), Executable(..) - , Library(..), libModules, hcOptions, usedExtensions ) +import Distribution.PackageDescription as PD hiding (Flag) import Distribution.InstalledPackageInfo - ( emptyInstalledPackageInfo, ) import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo import Distribution.Simple.PackageIndex (InstalledPackageIndex) import qualified Distribution.Simple.PackageIndex as PackageIndex import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), ComponentLocalBuildInfo(..) ) import Distribution.Simple.BuildPaths - ( autogenModulesDir, exeExtension ) import Distribution.Simple.Compiler - ( CompilerFlavor(..), CompilerId(..), Compiler(..), AbiTag(..) - , PackageDBStack, Flag, languageToFlags, extensionsToFlags ) import Language.Haskell.Extension - ( Language(Haskell98), Extension(..), KnownExtension(..)) import Distribution.Simple.Program - ( ConfiguredProgram(..), jhcProgram, ProgramConfiguration - , userMaybeSpecifyPath, requireProgramVersion, lookupProgram - , rawSystemProgram, rawSystemProgramStdoutConf ) import Distribution.Version - ( Version(..), orLaterVersion ) import Distribution.Package - ( Package(..), ComponentId(ComponentId), - pkgName, pkgVersion, ) import Distribution.Simple.Utils - ( createDirectoryIfMissingVerbose, writeFileAtomic - , installOrdinaryFile, installExecutableFile - , intercalate ) -import System.FilePath ( () ) import Distribution.Verbosity import Distribution.Text - ( Text(parse), display ) + +import System.FilePath ( () ) import Distribution.Compat.ReadP ( readP_to_S, string, skipSpaces ) import Distribution.System ( Platform ) diff --git a/Cabal/Distribution/Simple/LHC.hs b/Cabal/Distribution/Simple/LHC.hs index bf8c2955ea8..6d44e627e5c 100644 --- a/Cabal/Distribution/Simple/LHC.hs +++ b/Cabal/Distribution/Simple/LHC.hs @@ -40,50 +40,25 @@ module Distribution.Simple.LHC ( ghcVerbosityOptions ) where -import Distribution.PackageDescription as PD - ( PackageDescription(..), BuildInfo(..), Executable(..) - , Library(..), libModules, hcOptions, hcProfOptions, hcSharedOptions - , usedExtensions, allExtensions ) +import Distribution.PackageDescription as PD hiding (Flag) import Distribution.InstalledPackageInfo - ( InstalledPackageInfo - , parseInstalledPackageInfo ) import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo - ( InstalledPackageInfo(..) ) import Distribution.Simple.PackageIndex import qualified Distribution.Simple.PackageIndex as PackageIndex -import Distribution.ParseUtils ( ParseResult(..) ) import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), ComponentLocalBuildInfo(..) ) -import Distribution.Simple.InstallDirs import Distribution.Simple.BuildPaths import Distribution.Simple.Utils import Distribution.Package - ( Package(..), getHSLibraryName, ComponentId ) import qualified Distribution.ModuleName as ModuleName import Distribution.Simple.Program - ( Program(..), ConfiguredProgram(..), ProgramConfiguration - , ProgramSearchPath, ProgramLocation(..) - , rawSystemProgram, rawSystemProgramConf - , rawSystemProgramStdout, rawSystemProgramStdoutConf - , requireProgramVersion - , userMaybeSpecifyPath, programPath, lookupProgram, addKnownProgram - , arProgram, ldProgram - , gccProgram, stripProgram - , lhcProgram, lhcPkgProgram ) import qualified Distribution.Simple.Program.HcPkg as HcPkg import Distribution.Simple.Compiler - ( CompilerFlavor(..), CompilerId(..), Compiler(..), compilerVersion - , OptimisationLevel(..), PackageDB(..), PackageDBStack, AbiTag(..) - , Flag, languageToFlags, extensionsToFlags ) import Distribution.Version - ( Version(..), orLaterVersion ) -import Distribution.System - ( OS(..), buildOS ) import Distribution.Verbosity import Distribution.Text - ( display, simpleParse ) +import Distribution.Compat.Exception +import Distribution.System import Language.Haskell.Extension - ( Language(Haskell98), Extension(..), KnownExtension(..) ) import Control.Monad ( unless, when ) import Data.Monoid as Mon @@ -96,8 +71,6 @@ import System.Directory ( removeFile, renameFile, import System.FilePath ( (), (<.>), takeExtension, takeDirectory, replaceExtension ) import System.IO (hClose, hPutStrLn) -import Distribution.Compat.Exception (catchExit, catchIO) -import Distribution.System ( Platform ) -- ----------------------------------------------------------------------------- -- Configuring diff --git a/Cabal/Distribution/Simple/LocalBuildInfo.hs b/Cabal/Distribution/Simple/LocalBuildInfo.hs index 1e3f0cb2f5b..aaf607eb9bd 100644 --- a/Cabal/Distribution/Simple/LocalBuildInfo.hs +++ b/Cabal/Distribution/Simple/LocalBuildInfo.hs @@ -62,30 +62,18 @@ import Distribution.Simple.InstallDirs hiding (absoluteInstallDirs, prefixRelativeInstallDirs, substPathTemplate, ) import qualified Distribution.Simple.InstallDirs as InstallDirs -import Distribution.Simple.Program (ProgramConfiguration) -import Distribution.InstalledPackageInfo (InstalledPackageInfo) +import Distribution.Simple.Program +import Distribution.InstalledPackageInfo import Distribution.PackageDescription - ( PackageDescription(..), withLib, Library(libBuildInfo), withExe - , Executable(exeName, buildInfo), withTest, TestSuite(..) - , BuildInfo(buildable), Benchmark(..), ModuleRenaming(..) ) import qualified Distribution.InstalledPackageInfo as Installed import Distribution.Package - ( PackageId, Package(..), ComponentId(..) - , PackageName, ComponentId(..) ) import Distribution.Simple.Compiler - ( Compiler, compilerInfo, PackageDBStack, DebugInfoLevel - , OptimisationLevel, ProfDetailLevel ) import Distribution.Simple.PackageIndex - ( InstalledPackageIndex, allPackages ) -import Distribution.ModuleName ( ModuleName ) +import Distribution.ModuleName import Distribution.Simple.Setup - ( ConfigFlags ) import Distribution.Simple.Utils - ( shortRelativePath ) import Distribution.Text - ( display ) import Distribution.System - ( Platform (..) ) import Data.Array ((!)) import Distribution.Compat.Binary (Binary) diff --git a/Cabal/Distribution/Simple/PackageIndex.hs b/Cabal/Distribution/Simple/PackageIndex.hs index 0d2a5b47abc..63e0e13076f 100644 --- a/Cabal/Distribution/Simple/PackageIndex.hs +++ b/Cabal/Distribution/Simple/PackageIndex.hs @@ -61,15 +61,21 @@ module Distribution.Simple.PackageIndex ( moduleNameIndex, ) where +import Distribution.Compat.Binary +import Distribution.Compat.Semigroup as Semi +import Distribution.Package +import Distribution.ModuleName +import qualified Distribution.InstalledPackageInfo as IPI +import Distribution.Version +import Distribution.Simple.Utils + import Control.Exception (assert) import Data.Array ((!)) import qualified Data.Array as Array -import Distribution.Compat.Binary (Binary) -import Distribution.Compat.Semigroup as Semi import qualified Data.Graph as Graph import Data.List as List ( null, foldl', sort - , groupBy, sortBy, find, isInfixOf, nubBy, deleteBy, deleteFirstsBy ) + , groupBy, sortBy, find, nubBy, deleteBy, deleteFirstsBy ) import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe (isNothing, fromMaybe) @@ -77,21 +83,6 @@ import qualified Data.Tree as Tree import GHC.Generics (Generic) import Prelude hiding (lookup) -import Distribution.Package - ( PackageName(..), PackageId - , Package(..), packageName, packageVersion - , Dependency(Dependency)--, --PackageFixedDeps(..) - , HasComponentId(..), PackageInstalled(..) - , ComponentId ) -import Distribution.ModuleName - ( ModuleName ) -import Distribution.InstalledPackageInfo - ( InstalledPackageInfo ) -import qualified Distribution.InstalledPackageInfo as IPI -import Distribution.Version - ( Version, withinRange ) -import Distribution.Simple.Utils (lowercase, comparing, equating) - -- | The collection of information about packages from one or more 'PackageDB's. -- These packages generally should have an instance of 'PackageInstalled' -- @@ -123,7 +114,7 @@ instance Binary a => Binary (PackageIndex a) -- | The default package index which contains 'InstalledPackageInfo'. Normally -- use this. -type InstalledPackageIndex = PackageIndex InstalledPackageInfo +type InstalledPackageIndex = PackageIndex IPI.InstalledPackageInfo instance HasComponentId a => Monoid (PackageIndex a) where mempty = PackageIndex Map.empty Map.empty @@ -600,7 +591,7 @@ dependencyInconsistencies index = -- 'InstalledPackageIndex' and turns it into a map from module names to their -- source packages. It's used to initialize the @build-deps@ field in @cabal -- init@. -moduleNameIndex :: InstalledPackageIndex -> Map ModuleName [InstalledPackageInfo] +moduleNameIndex :: InstalledPackageIndex -> Map ModuleName [IPI.InstalledPackageInfo] moduleNameIndex index = Map.fromListWith (++) $ do pkg <- allPackages index diff --git a/Cabal/Distribution/Simple/PreProcess.hs b/Cabal/Distribution/Simple/PreProcess.hs index 9c3e2032c8d..1f2fb5914d3 100644 --- a/Cabal/Distribution/Simple/PreProcess.hs +++ b/Cabal/Distribution/Simple/PreProcess.hs @@ -27,49 +27,25 @@ module Distribution.Simple.PreProcess (preprocessComponent, preprocessExtras, where -import Control.Monad -import Distribution.Simple.PreProcess.Unlit (unlit) +import Distribution.Simple.PreProcess.Unlit import Distribution.Package - ( Package(..), PackageName(..) ) import qualified Distribution.ModuleName as ModuleName import Distribution.PackageDescription as PD - ( PackageDescription(..), BuildInfo(..) - , Executable(..) - , Library(..), libModules - , TestSuite(..), testModules - , TestSuiteInterface(..) - , Benchmark(..), benchmarkModules, BenchmarkInterface(..) ) import qualified Distribution.InstalledPackageInfo as Installed - ( InstalledPackageInfo(..) ) import qualified Distribution.Simple.PackageIndex as PackageIndex import Distribution.Simple.CCompiler - ( cSourceExtensions ) import Distribution.Simple.Compiler - ( CompilerFlavor(..) - , compilerFlavor, compilerCompatVersion, compilerVersion ) import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), Component(..) ) -import Distribution.Simple.BuildPaths (autogenModulesDir,cppHeaderName) +import Distribution.Simple.BuildPaths import Distribution.Simple.Utils - ( createDirectoryIfMissingVerbose, withUTF8FileContents, writeUTF8File - , die, setupMessage, intercalate, copyFileVerbose, moreRecentFile - , findFileWithExtension, findFileWithExtension' - , getDirectoryContentsRecursive ) import Distribution.Simple.Program - ( Program(..), ConfiguredProgram(..), programPath - , requireProgram, requireProgramVersion - , rawSystemProgramConf, rawSystemProgram - , greencardProgram, cpphsProgram, hsc2hsProgram, c2hsProgram - , happyProgram, alexProgram, ghcProgram, ghcjsProgram, gccProgram ) import Distribution.Simple.Test.LibV09 - ( writeSimpleTestStub, stubFilePath, stubName ) import Distribution.System - ( OS(..), buildOS, Arch(..), Platform(..) ) import Distribution.Text import Distribution.Version - ( Version(..), anyVersion, orLaterVersion ) import Distribution.Verbosity +import Control.Monad import Data.Maybe (fromMaybe) import Data.List (nub, isSuffixOf) import System.Directory (doesFileExist) diff --git a/Cabal/Distribution/Simple/Program.hs b/Cabal/Distribution/Simple/Program.hs index ddd0cd7b021..1624b6e16e1 100644 --- a/Cabal/Distribution/Simple/Program.hs +++ b/Cabal/Distribution/Simple/Program.hs @@ -132,11 +132,8 @@ import Distribution.Simple.Program.Run import Distribution.Simple.Program.Db import Distribution.Simple.Program.Builtin import Distribution.Simple.Program.Find - import Distribution.Simple.Utils - ( die, findProgramLocation, findProgramVersion ) import Distribution.Verbosity - ( Verbosity ) -- | Runs the given configured program. diff --git a/Cabal/Distribution/Simple/Program/Builtin.hs b/Cabal/Distribution/Simple/Program/Builtin.hs index 697cdb691bd..7b2af3e07f4 100644 --- a/Cabal/Distribution/Simple/Program/Builtin.hs +++ b/Cabal/Distribution/Simple/Program/Builtin.hs @@ -46,27 +46,16 @@ module Distribution.Simple.Program.Builtin ( ) where import Distribution.Simple.Program.Find - ( findProgramOnSearchPath ) import Distribution.Simple.Program.Internal - ( stripExtractVersion ) import Distribution.Simple.Program.Run - ( getProgramInvocationOutput, programInvocation ) import Distribution.Simple.Program.Types - ( Program(..), ConfiguredProgram(..), simpleProgram ) import Distribution.Simple.Utils - ( findProgramVersion ) import Distribution.Compat.Exception - ( catchIO ) import Distribution.Verbosity - ( lessVerbose ) import Distribution.Version - ( Version(..), withinRange, earlierVersion, laterVersion - , intersectVersionRanges ) + import Data.Char ( isDigit ) - -import Data.List - ( isInfixOf ) import qualified Data.Map as Map -- ------------------------------------------------------------ diff --git a/Cabal/Distribution/Simple/Program/Db.hs b/Cabal/Distribution/Simple/Program/Db.hs index 0f300f82736..001dd30b35f 100644 --- a/Cabal/Distribution/Simple/Program/Db.hs +++ b/Cabal/Distribution/Simple/Program/Db.hs @@ -56,22 +56,14 @@ module Distribution.Simple.Program.Db ( ) where import Distribution.Simple.Program.Types - ( Program(..), ProgArg, ConfiguredProgram(..), ProgramLocation(..) ) import Distribution.Simple.Program.Find - ( ProgramSearchPath, defaultProgramSearchPath - , findProgramOnSearchPath, programSearchPathAsPATHVar ) import Distribution.Simple.Program.Builtin - ( builtinPrograms ) import Distribution.Simple.Utils - ( die, doesExecutableExist ) import Distribution.Version - ( Version, VersionRange, isAnyVersion, withinRange ) import Distribution.Text - ( display ) import Distribution.Verbosity - ( Verbosity ) +import Distribution.Compat.Binary -import Distribution.Compat.Binary (Binary(..)) import Data.List ( foldl' ) import Data.Maybe @@ -455,7 +447,7 @@ lookupProgramVersion verbosity prog range programDb = do | otherwise -> return $! Left (badVersion version location) Nothing -> - return $! Left (noVersion location) + return $! Left (unknownVersion location) where notFound = "The program '" ++ programName prog ++ "'" ++ versionRequirement @@ -464,7 +456,7 @@ lookupProgramVersion verbosity prog range programDb = do ++ programName prog ++ "'" ++ versionRequirement ++ " is required but the version found at " ++ locationPath l ++ " is version " ++ display v - noVersion l = "The program '" + unknownVersion l = "The program '" ++ programName prog ++ "'" ++ versionRequirement ++ " is required but the version of " ++ locationPath l ++ " could not be determined." diff --git a/Cabal/Distribution/Simple/Program/Find.hs b/Cabal/Distribution/Simple/Program/Find.hs index 265cca1f246..a3482cbd33e 100644 --- a/Cabal/Distribution/Simple/Program/Find.hs +++ b/Cabal/Distribution/Simple/Program/Find.hs @@ -32,21 +32,18 @@ module Distribution.Simple.Program.Find ( ) where import Distribution.Verbosity - ( Verbosity ) import Distribution.Simple.Utils - ( debug, doesExecutableExist ) import Distribution.System - ( OS(..), buildOS ) +import Distribution.Compat.Environment +import Distribution.Compat.Binary + import qualified System.Directory as Directory ( findExecutable ) -import Distribution.Compat.Environment - ( getEnvironment ) import System.FilePath as FilePath ( (), (<.>), splitSearchPath, searchPathSeparator, getSearchPath , takeDirectory ) import Data.List - ( intercalate, nub ) -import Distribution.Compat.Binary + ( nub ) import GHC.Generics #if defined(mingw32_HOST_OS) import qualified System.Win32 as Win32 diff --git a/Cabal/Distribution/Simple/Program/GHC.hs b/Cabal/Distribution/Simple/Program/GHC.hs index 100b54f6436..e403f18db62 100644 --- a/Cabal/Distribution/Simple/Program/GHC.hs +++ b/Cabal/Distribution/Simple/Program/GHC.hs @@ -13,19 +13,18 @@ module Distribution.Simple.Program.GHC ( ) where import Distribution.Compat.Semigroup as Semi -import Distribution.Simple.GHC.ImplInfo ( getImplInfo, GhcImplInfo(..) ) +import Distribution.Simple.GHC.ImplInfo import Distribution.Package import Distribution.PackageDescription hiding (Flag) import Distribution.ModuleName import Distribution.Simple.Compiler hiding (Flag) -import Distribution.Simple.Setup ( Flag(..), flagToMaybe, fromFlagOrDefault, - flagToList ) +import Distribution.Simple.Setup import Distribution.Simple.Program.Types import Distribution.Simple.Program.Run import Distribution.Text import Distribution.Verbosity -import Distribution.Utils.NubList ( NubListR, fromNubListR ) -import Language.Haskell.Extension ( Language(..), Extension(..) ) +import Distribution.Utils.NubList +import Language.Haskell.Extension import qualified Data.Map as M import Data.List ( intercalate ) diff --git a/Cabal/Distribution/Simple/Program/HcPkg.hs b/Cabal/Distribution/Simple/Program/HcPkg.hs index 5fc64ee23b1..8c56d3372b8 100644 --- a/Cabal/Distribution/Simple/Program/HcPkg.hs +++ b/Cabal/Distribution/Simple/Program/HcPkg.hs @@ -39,30 +39,18 @@ module Distribution.Simple.Program.HcPkg ( listInvocation, ) where -import Prelude hiding (init) -import Distribution.Package - ( PackageId, ComponentId(..) ) +import Distribution.Package hiding (installedComponentId) import Distribution.InstalledPackageInfo - ( InstalledPackageInfo, InstalledPackageInfo(..) - , showInstalledPackageInfo - , emptyInstalledPackageInfo, fieldsInstalledPackageInfo ) import Distribution.ParseUtils import Distribution.Simple.Compiler - ( PackageDB(..), PackageDBStack ) import Distribution.Simple.Program.Types - ( ConfiguredProgram(programId) ) import Distribution.Simple.Program.Run - ( ProgramInvocation(..), IOEncoding(..), programInvocation - , runProgramInvocation, getProgramInvocationOutput ) import Distribution.Text - ( display, simpleParse ) import Distribution.Simple.Utils - ( die, writeUTF8File ) import Distribution.Verbosity - ( Verbosity, deafening, silent ) import Distribution.Compat.Exception - ( catchIO ) +import Prelude hiding (init) import Data.Char ( isSpace ) import Data.List diff --git a/Cabal/Distribution/Simple/Program/Hpc.hs b/Cabal/Distribution/Simple/Program/Hpc.hs index f3de271a876..3a788c6f976 100644 --- a/Cabal/Distribution/Simple/Program/Hpc.hs +++ b/Cabal/Distribution/Simple/Program/Hpc.hs @@ -13,14 +13,13 @@ module Distribution.Simple.Program.Hpc , union ) where -import Distribution.ModuleName ( ModuleName ) +import Distribution.ModuleName import Distribution.Simple.Program.Run - ( ProgramInvocation, programInvocation, runProgramInvocation ) -import Distribution.Simple.Program.Types ( ConfiguredProgram(..) ) -import Distribution.Text ( display ) -import Distribution.Simple.Utils ( warn ) -import Distribution.Verbosity ( Verbosity ) -import Distribution.Version ( Version(..), orLaterVersion, withinRange ) +import Distribution.Simple.Program.Types +import Distribution.Text +import Distribution.Simple.Utils +import Distribution.Verbosity +import Distribution.Version -- | Invoke hpc with the given parameters. -- diff --git a/Cabal/Distribution/Simple/Program/Run.hs b/Cabal/Distribution/Simple/Program/Run.hs index 22d57008416..7dae5ed2017 100644 --- a/Cabal/Distribution/Simple/Program/Run.hs +++ b/Cabal/Distribution/Simple/Program/Run.hs @@ -24,12 +24,9 @@ module Distribution.Simple.Program.Run ( ) where import Distribution.Simple.Program.Types - ( ConfiguredProgram(..), programPath ) import Distribution.Simple.Utils - ( die, rawSystemExit, rawSystemIOWithEnv, rawSystemStdInOut - , toUTF8, fromUTF8, normaliseLineEndings ) import Distribution.Verbosity - ( Verbosity ) +import Distribution.Compat.Environment import Data.List ( foldl', unfoldr ) @@ -38,8 +35,6 @@ import Control.Monad ( when ) import System.Exit ( ExitCode(..), exitWith ) -import Distribution.Compat.Environment - ( getEnvironment ) -- | Represents a specific invocation of a specific program. -- diff --git a/Cabal/Distribution/Simple/Program/Script.hs b/Cabal/Distribution/Simple/Program/Script.hs index 136538802fe..4c382ab2f6a 100644 --- a/Cabal/Distribution/Simple/Program/Script.hs +++ b/Cabal/Distribution/Simple/Program/Script.hs @@ -17,9 +17,7 @@ module Distribution.Simple.Program.Script ( ) where import Distribution.Simple.Program.Run - ( ProgramInvocation(..) ) import Distribution.System - ( OS(..) ) import Data.Maybe ( maybeToList ) diff --git a/Cabal/Distribution/Simple/Program/Strip.hs b/Cabal/Distribution/Simple/Program/Strip.hs index a77c1adde02..ce0654ee037 100644 --- a/Cabal/Distribution/Simple/Program/Strip.hs +++ b/Cabal/Distribution/Simple/Program/Strip.hs @@ -10,16 +10,13 @@ module Distribution.Simple.Program.Strip (stripLib, stripExe) where -import Distribution.Simple.Program (ProgramConfiguration, lookupProgram - , programVersion, rawSystemProgram - , stripProgram) -import Distribution.Simple.Utils (warn) -import Distribution.System (Arch(..), Platform(..), OS (..), buildOS) -import Distribution.Verbosity (Verbosity) -import Distribution.Version (orLaterVersion, withinRange) +import Distribution.Simple.Program +import Distribution.Simple.Utils +import Distribution.System +import Distribution.Verbosity +import Distribution.Version import Control.Monad (unless) -import Data.Version (Version(..)) import System.FilePath (takeBaseName) runStrip :: Verbosity -> ProgramConfiguration -> FilePath -> [String] -> IO () diff --git a/Cabal/Distribution/Simple/Program/Types.hs b/Cabal/Distribution/Simple/Program/Types.hs index c625b3723fe..c39fea104e2 100644 --- a/Cabal/Distribution/Simple/Program/Types.hs +++ b/Cabal/Distribution/Simple/Program/Types.hs @@ -33,14 +33,10 @@ module Distribution.Simple.Program.Types ( ) where import Distribution.Simple.Program.Find - ( ProgramSearchPath, ProgramSearchPathEntry(..) - , findProgramOnSearchPath ) import Distribution.Version - ( Version ) import Distribution.Verbosity - ( Verbosity ) +import Distribution.Compat.Binary -import Distribution.Compat.Binary (Binary) import qualified Data.Map as Map import GHC.Generics (Generic) diff --git a/Cabal/Distribution/Simple/Register.hs b/Cabal/Distribution/Simple/Register.hs index 44aee2db631..7fd91dc7326 100644 --- a/Cabal/Distribution/Simple/Register.hs +++ b/Cabal/Distribution/Simple/Register.hs @@ -41,10 +41,7 @@ module Distribution.Simple.Register ( ) where import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), ComponentLocalBuildInfo(..) - , ComponentName(..), getComponentLocalBuildInfo - , InstallDirs(..), absoluteInstallDirs ) -import Distribution.Simple.BuildPaths (haddockName) +import Distribution.Simple.BuildPaths import qualified Distribution.Simple.GHC as GHC import qualified Distribution.Simple.GHCJS as GHCJS @@ -53,36 +50,18 @@ import qualified Distribution.Simple.UHC as UHC import qualified Distribution.Simple.HaskellSuite as HaskellSuite import Distribution.Simple.Compiler - ( Compiler, CompilerFlavor(..), compilerFlavor, compilerVersion - , PackageDB, PackageDBStack, absolutePackageDBPaths - , registrationPackageDB ) import Distribution.Simple.Program - ( ProgramConfiguration, runProgramInvocation ) import Distribution.Simple.Program.Script - ( invocationAsSystemScript ) -import Distribution.Simple.Program.HcPkg (HcPkgInfo) import qualified Distribution.Simple.Program.HcPkg as HcPkg import Distribution.Simple.Setup - ( RegisterFlags(..), CopyDest(..) - , fromFlag, fromFlagOrDefault, flagToMaybe ) import Distribution.PackageDescription - ( PackageDescription(..), Library(..), BuildInfo(..), libModules ) import Distribution.Package - ( Package(..), packageName - , getHSLibraryName ) -import Distribution.InstalledPackageInfo - ( InstalledPackageInfo, InstalledPackageInfo(InstalledPackageInfo) - , showInstalledPackageInfo, AbiHash(..) ) import qualified Distribution.InstalledPackageInfo as IPI +import Distribution.InstalledPackageInfo (InstalledPackageInfo) import Distribution.Simple.Utils - ( writeUTF8File, writeFileAtomic, setFileExecutable - , die, notice, setupMessage, shortRelativePath ) import Distribution.System - ( OS(..), buildOS ) import Distribution.Text - ( display ) import Distribution.Verbosity as Verbosity - ( Verbosity, normal ) import System.FilePath ((), (<.>), isAbsolute) import System.Directory @@ -143,7 +122,7 @@ register pkg@PackageDescription { library = Just lib } lbi regFlags writeRegistrationFile installedPkgInfo = do notice verbosity ("Creating package registration file: " ++ regFile) - writeUTF8File regFile (showInstalledPackageInfo installedPkgInfo) + writeUTF8File regFile (IPI.showInstalledPackageInfo installedPkgInfo) writeRegisterScript installedPkgInfo = case compilerFlavor (compiler lbi) of @@ -256,7 +235,7 @@ invokeHcPkg verbosity comp conf dbStack extraArgs = (\hpi -> HcPkg.invoke hpi verbosity dbStack extraArgs) withHcPkg :: String -> Compiler -> ProgramConfiguration - -> (HcPkgInfo -> IO a) -> IO a + -> (HcPkg.HcPkgInfo -> IO a) -> IO a withHcPkg name comp conf f = case compilerFlavor comp of GHC -> f (GHC.hcPkgInfo conf) @@ -288,7 +267,7 @@ registerPackage verbosity comp progdb multiInstance packageDbs installedPkgInfo writeHcPkgRegisterScript :: Verbosity -> InstalledPackageInfo -> PackageDBStack - -> HcPkgInfo + -> HcPkg.HcPkgInfo -> IO () writeHcPkgRegisterScript verbosity installedPkgInfo packageDbs hpi = do let invocation = HcPkg.reregisterInvocation hpi Verbosity.normal @@ -322,7 +301,7 @@ generalInstalledPackageInfo -> InstallDirs FilePath -> InstalledPackageInfo generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDirs = - InstalledPackageInfo { + IPI.InstalledPackageInfo { IPI.sourcePackageId = packageId pkg, IPI.installedComponentId= componentId clbi, IPI.compatPackageKey = componentCompatPackageKey clbi, @@ -340,7 +319,7 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi IPI.exposed = libExposed lib, IPI.exposedModules = componentExposedModules clbi, IPI.hiddenModules = otherModules bi, - IPI.instantiatedWith = map (\(k,(p,n)) -> + IPI.installedInstantiatedWith = map (\(k,(p,n)) -> (k,IPI.OriginalModule (IPI.installedComponentId p) n)) (instantiatedWith lbi), IPI.trusted = IPI.trusted IPI.emptyInstalledPackageInfo, diff --git a/Cabal/Distribution/Simple/Setup.hs b/Cabal/Distribution/Simple/Setup.hs index 21a34b77385..21ac632baf6 100644 --- a/Cabal/Distribution/Simple/Setup.hs +++ b/Cabal/Distribution/Simple/Setup.hs @@ -66,43 +66,26 @@ module Distribution.Simple.Setup ( flagToList, boolOpt, boolOpt', trueArg, falseArg, optionVerbosity, optionNumJobs ) where -import Distribution.Compiler () +import Distribution.Compiler import Distribution.ReadE import Distribution.Text - ( Text(..), display ) import qualified Distribution.Compat.ReadP as Parse import qualified Text.PrettyPrint as Disp import Distribution.ModuleName -import Distribution.Package ( Dependency(..) - , PackageName - , ComponentId(..) ) -import Distribution.PackageDescription - ( FlagName(..), FlagAssignment ) +import Distribution.Package +import Distribution.PackageDescription hiding (Flag) import Distribution.Simple.Command hiding (boolOpt, boolOpt') import qualified Distribution.Simple.Command as Command -import Distribution.Simple.Compiler - ( CompilerFlavor(..), defaultCompilerFlavor, PackageDB(..) - , DebugInfoLevel(..), flagToDebugInfoLevel - , OptimisationLevel(..), flagToOptimisationLevel - , ProfDetailLevel(..), flagToProfDetailLevel, showProfDetailLevel - , absolutePackageDBPath ) +import Distribution.Simple.Compiler hiding (Flag) import Distribution.Simple.Utils - ( wrapText, wrapLine, lowercase, intercalate ) -import Distribution.Simple.Program (Program(..), ProgramConfiguration, - requireProgram, - programInvocation, progInvokePath, progInvokeArgs, - knownPrograms, - addKnownProgram, emptyProgramConfiguration, - haddockProgram, ghcProgram, gccProgram, ldProgram) +import Distribution.Simple.Program import Distribution.Simple.InstallDirs - ( InstallDirs(..), CopyDest(..), - PathTemplate, toPathTemplate, fromPathTemplate ) import Distribution.Verbosity import Distribution.Utils.NubList - -import Control.Monad (liftM) import Distribution.Compat.Binary (Binary) import Distribution.Compat.Semigroup as Semi + +import Control.Monad (liftM) import Data.List ( sort ) import Data.Char ( isSpace, isAlpha ) import GHC.Generics (Generic) @@ -227,8 +210,8 @@ globalCommand commands = CommandUI align str = str ++ replicate (maxlen - length str) ' ' in "Commands:\n" - ++ unlines [ " " ++ align name ++ " " ++ description - | (name, description) <- cmdDescs ] + ++ unlines [ " " ++ align name ++ " " ++ descr + | (name, descr) <- cmdDescs ] ++ "\n" ++ "For more information about a command use\n" ++ " " ++ pname ++ " COMMAND --help\n\n" diff --git a/Cabal/Distribution/Simple/SrcDist.hs b/Cabal/Distribution/Simple/SrcDist.hs index 1c8f130e5f8..a2feafd9b1f 100644 --- a/Cabal/Distribution/Simple/SrcDist.hs +++ b/Cabal/Distribution/Simple/SrcDist.hs @@ -40,35 +40,20 @@ module Distribution.Simple.SrcDist ( ) where -import Distribution.PackageDescription - ( PackageDescription(..), BuildInfo(..), Executable(..), Library(..) - , TestSuite(..), TestSuiteInterface(..), Benchmark(..) - , BenchmarkInterface(..) ) -import Distribution.PackageDescription.Check - ( PackageCheck(..), checkConfiguredPackage, checkPackageFiles ) +import Distribution.PackageDescription hiding (Flag) +import Distribution.PackageDescription.Check hiding (doesFileExist) import Distribution.Package - ( PackageIdentifier(pkgVersion), Package(..), packageVersion ) -import Distribution.ModuleName (ModuleName) +import Distribution.ModuleName import qualified Distribution.ModuleName as ModuleName import Distribution.Version - ( Version(versionBranch) ) import Distribution.Simple.Utils - ( createDirectoryIfMissingVerbose, withUTF8FileContents, writeUTF8File - , installOrdinaryFiles, installMaybeExecutableFiles - , findFile, findFileWithExtension, findAllFilesWithExtension, matchFileGlob - , withTempDirectory, defaultPackageDesc - , die, warn, notice, info, setupMessage ) -import Distribution.Simple.Setup ( Flag(..), SDistFlags(..) - , fromFlag, flagToMaybe) -import Distribution.Simple.PreProcess ( PPSuffixHandler, ppSuffixes - , preprocessComponent ) +import Distribution.Simple.Setup +import Distribution.Simple.PreProcess import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..), withAllComponentsInBuildOrder ) -import Distribution.Simple.BuildPaths ( autogenModuleName ) -import Distribution.Simple.Program ( defaultProgramConfiguration, requireProgram, - runProgram, programProperties, tarProgram ) +import Distribution.Simple.BuildPaths +import Distribution.Simple.Program import Distribution.Text - ( display ) +import Distribution.Verbosity import Control.Monad(when, unless, forM) import Data.Char (toLower) @@ -78,7 +63,6 @@ import Data.Maybe (isNothing, catMaybes) import Data.Time (UTCTime, getCurrentTime, toGregorian, utctDay) import System.Directory ( doesFileExist ) import System.IO (IOMode(WriteMode), hPutStrLn, withFile) -import Distribution.Verbosity (Verbosity) import System.FilePath ( (), (<.>), dropExtension, isAbsolute ) @@ -169,19 +153,19 @@ listPackageSourcesOrdinary verbosity pkg_descr pps = fmap concat . sequence $ [ -- Library sources. - withLib $ \Library { exposedModules = modules, libBuildInfo = libBi } -> + withAllLib $ \Library { exposedModules = modules, libBuildInfo = libBi } -> allSourcesBuildInfo libBi pps modules -- Executables sources. , fmap concat - . withExe $ \Executable { modulePath = mainPath, buildInfo = exeBi } -> do + . withAllExe $ \Executable { modulePath = mainPath, buildInfo = exeBi } -> do biSrcs <- allSourcesBuildInfo exeBi pps [] mainSrc <- findMainExeFile exeBi pps mainPath return (mainSrc:biSrcs) -- Test suites sources. , fmap concat - . withTest $ \t -> do + . withAllTest $ \t -> do let bi = testBuildInfo t case testInterface t of TestSuiteExeV10 _ mainPath -> do @@ -200,7 +184,7 @@ listPackageSourcesOrdinary verbosity pkg_descr pps = -- Benchmarks sources. , fmap concat - . withBenchmark $ \bm -> do + . withAllBenchmark $ \bm -> do let bi = benchmarkBuildInfo bm case benchmarkInterface bm of BenchmarkExeV10 _ mainPath -> do @@ -229,7 +213,7 @@ listPackageSourcesOrdinary verbosity pkg_descr pps = , return (licenseFiles pkg_descr) -- Install-include files. - , withLib $ \ l -> do + , withAllLib $ \ l -> do let lbi = libBuildInfo l relincdirs = "." : filter (not.isAbsolute) (includeDirs lbi) mapM (fmap snd . findIncludeFile relincdirs) (installIncludes lbi) @@ -244,10 +228,10 @@ listPackageSourcesOrdinary verbosity pkg_descr pps = where -- We have to deal with all libs and executables, so we have local -- versions of these functions that ignore the 'buildable' attribute: - withLib action = maybe (return []) action (library pkg_descr) - withExe action = mapM action (executables pkg_descr) - withTest action = mapM action (testSuites pkg_descr) - withBenchmark action = mapM action (benchmarks pkg_descr) + withAllLib action = maybe (return []) action (library pkg_descr) + withAllExe action = mapM action (executables pkg_descr) + withAllTest action = mapM action (testSuites pkg_descr) + withAllBenchmark action = mapM action (benchmarks pkg_descr) -- |Prepare a directory tree of source files. diff --git a/Cabal/Distribution/Simple/Test.hs b/Cabal/Distribution/Simple/Test.hs index 2653bca6424..dd2d1f74541 100644 --- a/Cabal/Distribution/Simple/Test.hs +++ b/Cabal/Distribution/Simple/Test.hs @@ -16,22 +16,17 @@ module Distribution.Simple.Test ) where import qualified Distribution.PackageDescription as PD - ( PackageDescription(..), BuildInfo(buildable) - , TestSuite(..) - , TestSuiteInterface(..), testType, hasTests ) -import Distribution.Simple.Compiler ( compilerInfo ) -import Distribution.Simple.Hpc ( markupPackage ) +import Distribution.Simple.Compiler +import Distribution.Simple.Hpc import Distribution.Simple.InstallDirs - ( fromPathTemplate, initialPathTemplateEnv, substPathTemplate - , PathTemplate ) import qualified Distribution.Simple.LocalBuildInfo as LBI -import Distribution.Simple.Setup ( TestFlags(..), fromFlag, configCoverage ) -import Distribution.Simple.UserHooks ( Args ) +import Distribution.Simple.Setup +import Distribution.Simple.UserHooks import qualified Distribution.Simple.Test.ExeV10 as ExeV10 import qualified Distribution.Simple.Test.LibV09 as LibV09 import Distribution.Simple.Test.Log -import Distribution.Simple.Utils ( die, notice ) -import Distribution.TestSuite ( Result(..) ) +import Distribution.Simple.Utils +import Distribution.TestSuite import Distribution.Text import Control.Monad ( when, unless, filterM ) diff --git a/Cabal/Distribution/Simple/Test/ExeV10.hs b/Cabal/Distribution/Simple/Test/ExeV10.hs index 236ae36e64c..3b1eac004b2 100644 --- a/Cabal/Distribution/Simple/Test/ExeV10.hs +++ b/Cabal/Distribution/Simple/Test/ExeV10.hs @@ -2,26 +2,22 @@ module Distribution.Simple.Test.ExeV10 ( runTest ) where -import Distribution.Compat.CreatePipe ( createPipe ) -import Distribution.Compat.Environment ( getEnvironment ) +import Distribution.Compat.CreatePipe +import Distribution.Compat.Environment import qualified Distribution.PackageDescription as PD -import Distribution.Simple.Build.PathsModule ( pkgPathEnvVar ) -import Distribution.Simple.BuildPaths ( exeExtension ) -import Distribution.Simple.Compiler ( compilerInfo ) -import Distribution.Simple.Hpc ( guessWay, markupTest, tixDir, tixFilePath ) +import Distribution.Simple.Build.PathsModule +import Distribution.Simple.BuildPaths +import Distribution.Simple.Compiler +import Distribution.Simple.Hpc import Distribution.Simple.InstallDirs - ( fromPathTemplate, initialPathTemplateEnv, PathTemplateVariable(..) - , substPathTemplate , toPathTemplate, PathTemplate ) import qualified Distribution.Simple.LocalBuildInfo as LBI import Distribution.Simple.Setup - ( TestFlags(..), TestShowDetails(..), fromFlag, configCoverage ) import Distribution.Simple.Test.Log import Distribution.Simple.Utils - ( die, notice, rawSystemIOWithEnv, addLibraryPath ) -import Distribution.System ( Platform (..) ) +import Distribution.System import Distribution.TestSuite import Distribution.Text -import Distribution.Verbosity ( normal ) +import Distribution.Verbosity import Control.Concurrent (forkIO) import Control.Monad ( unless, void, when ) diff --git a/Cabal/Distribution/Simple/Test/LibV09.hs b/Cabal/Distribution/Simple/Test/LibV09.hs index 34d2f722506..8e1f548c9e5 100644 --- a/Cabal/Distribution/Simple/Test/LibV09.hs +++ b/Cabal/Distribution/Simple/Test/LibV09.hs @@ -6,28 +6,24 @@ module Distribution.Simple.Test.LibV09 , writeSimpleTestStub ) where -import Distribution.Compat.CreatePipe ( createPipe ) -import Distribution.Compat.Environment ( getEnvironment ) -import Distribution.Compat.Internal.TempFile ( openTempFile ) -import Distribution.ModuleName ( ModuleName ) +import Distribution.Compat.CreatePipe +import Distribution.Compat.Environment +import Distribution.Compat.Internal.TempFile +import Distribution.ModuleName import qualified Distribution.PackageDescription as PD -import Distribution.Simple.Build.PathsModule ( pkgPathEnvVar ) -import Distribution.Simple.BuildPaths ( exeExtension ) -import Distribution.Simple.Compiler ( compilerInfo ) -import Distribution.Simple.Hpc ( guessWay, markupTest, tixDir, tixFilePath ) +import Distribution.Simple.Build.PathsModule +import Distribution.Simple.BuildPaths +import Distribution.Simple.Compiler +import Distribution.Simple.Hpc import Distribution.Simple.InstallDirs - ( fromPathTemplate, initialPathTemplateEnv, PathTemplateVariable(..) - , substPathTemplate , toPathTemplate, PathTemplate ) import qualified Distribution.Simple.LocalBuildInfo as LBI import Distribution.Simple.Setup - ( TestFlags(..), TestShowDetails(..), fromFlag, configCoverage ) import Distribution.Simple.Test.Log import Distribution.Simple.Utils - ( die, debug, notice, createProcessWithEnv, addLibraryPath ) -import Distribution.System ( Platform (..) ) +import Distribution.System import Distribution.TestSuite import Distribution.Text -import Distribution.Verbosity ( normal ) +import Distribution.Verbosity import Control.Exception ( bracket ) import Control.Monad ( when, unless ) diff --git a/Cabal/Distribution/Simple/Test/Log.hs b/Cabal/Distribution/Simple/Test/Log.hs index b8fc125c77b..9a20203a166 100644 --- a/Cabal/Distribution/Simple/Test/Log.hs +++ b/Cabal/Distribution/Simple/Test/Log.hs @@ -11,18 +11,16 @@ module Distribution.Simple.Test.Log , testSuiteLogPath ) where -import Distribution.Package ( PackageId ) +import Distribution.Package import qualified Distribution.PackageDescription as PD -import Distribution.Simple.Compiler ( Compiler(..), compilerInfo, CompilerId ) +import Distribution.Simple.Compiler import Distribution.Simple.InstallDirs - ( fromPathTemplate, initialPathTemplateEnv, PathTemplateVariable(..) - , substPathTemplate , toPathTemplate, PathTemplate ) import qualified Distribution.Simple.LocalBuildInfo as LBI -import Distribution.Simple.Setup ( TestShowDetails(..) ) -import Distribution.Simple.Utils ( notice ) -import Distribution.System ( Platform ) -import Distribution.TestSuite ( Options, Result(..) ) -import Distribution.Verbosity ( Verbosity ) +import Distribution.Simple.Setup +import Distribution.Simple.Utils +import Distribution.System +import Distribution.TestSuite +import Distribution.Verbosity import Control.Monad ( when ) import Data.Char ( toUpper ) @@ -109,13 +107,13 @@ testSuiteLogPath :: PathTemplate -> String -- ^ test suite name -> TestLogs -- ^ test suite results -> FilePath -testSuiteLogPath template pkg_descr lbi name result = +testSuiteLogPath template pkg_descr lbi test_name result = fromPathTemplate $ substPathTemplate env template where env = initialPathTemplateEnv (PD.package pkg_descr) (LBI.localComponentId lbi) (compilerInfo $ LBI.compiler lbi) (LBI.hostPlatform lbi) - ++ [ (TestSuiteNameVar, toPathTemplate name) + ++ [ (TestSuiteNameVar, toPathTemplate test_name) , (TestSuiteResultVar, toPathTemplate $ resultString result) ] diff --git a/Cabal/Distribution/Simple/UHC.hs b/Cabal/Distribution/Simple/UHC.hs index 7da4c3ba46c..c6c677f0f6d 100644 --- a/Cabal/Distribution/Simple/UHC.hs +++ b/Cabal/Distribution/Simple/UHC.hs @@ -19,9 +19,6 @@ module Distribution.Simple.UHC ( buildLib, buildExe, installLib, registerPackage, inplacePackageDbPath ) where -import Control.Monad -import Data.List -import qualified Data.Map as M ( empty ) import Distribution.Compat.ReadP import Distribution.InstalledPackageInfo import Distribution.Package hiding (installedComponentId) @@ -35,10 +32,14 @@ import Distribution.Simple.Utils import Distribution.Text import Distribution.Verbosity import Distribution.Version +import Distribution.System import Language.Haskell.Extension + +import Control.Monad +import Data.List +import qualified Data.Map as M ( empty ) import System.Directory import System.FilePath -import Distribution.System ( Platform ) -- ----------------------------------------------------------------------------- -- Configuring diff --git a/Cabal/Distribution/Simple/UserHooks.hs b/Cabal/Distribution/Simple/UserHooks.hs index abb7b760430..872309bfd46 100644 --- a/Cabal/Distribution/Simple/UserHooks.hs +++ b/Cabal/Distribution/Simple/UserHooks.hs @@ -29,16 +29,11 @@ module Distribution.Simple.UserHooks ( ) where import Distribution.PackageDescription - (PackageDescription, GenericPackageDescription, - HookedBuildInfo, emptyHookedBuildInfo) -import Distribution.Simple.Program (Program) -import Distribution.Simple.Command (noExtraFlags) -import Distribution.Simple.PreProcess (PPSuffixHandler) +import Distribution.Simple.Program +import Distribution.Simple.Command +import Distribution.Simple.PreProcess import Distribution.Simple.Setup - (ConfigFlags, BuildFlags, ReplFlags, CleanFlags, CopyFlags, - InstallFlags, SDistFlags, RegisterFlags, HscolourFlags, - HaddockFlags, TestFlags, BenchmarkFlags) -import Distribution.Simple.LocalBuildInfo (LocalBuildInfo) +import Distribution.Simple.LocalBuildInfo type Args = [String] diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs index 2451e81737f..05b580fb4d7 100644 --- a/Cabal/Distribution/Simple/Utils.hs +++ b/Cabal/Distribution/Simple/Utils.hs @@ -136,6 +136,20 @@ module Distribution.Simple.Utils ( wrapLine, ) where +import Distribution.Text +import Distribution.Package +import Distribution.ModuleName as ModuleName +import Distribution.System +import Distribution.Version +import Distribution.Compat.CopyFile +import Distribution.Compat.Internal.TempFile +import Distribution.Compat.Exception +import Distribution.Verbosity + +#ifdef VERSION_base +import qualified Paths_Cabal (version) +#endif + import Control.Monad ( when, unless, filterM ) import Control.Concurrent.MVar @@ -147,9 +161,11 @@ import Data.Char as Char import Data.Foldable ( traverse_ ) import Data.List - ( nub, unfoldr, isPrefixOf, tails, intercalate ) + ( nub, unfoldr, intercalate, isInfixOf ) import Data.Typeable ( cast ) +import Data.Ord + ( comparing ) import qualified Data.ByteString.Lazy as BS import qualified Data.ByteString.Lazy.Char8 as BS.Char8 import qualified Data.Set as Set @@ -182,17 +198,6 @@ import System.IO.Unsafe ( unsafeInterleaveIO ) import qualified Control.Exception as Exception -import Distribution.Text - ( display, simpleParse ) -import Distribution.Package - ( PackageIdentifier ) -import Distribution.ModuleName (ModuleName) -import qualified Distribution.ModuleName as ModuleName -import Distribution.System - ( OS (..) ) -import Distribution.Version - (Version(..)) - import Control.Exception (IOException, evaluate, throwIO) import Control.Concurrent (forkIO) import qualified System.Process as Process @@ -200,18 +205,6 @@ import qualified System.Process as Process import System.Process ( ProcessHandle, createProcess, rawSystem, runInteractiveProcess , showCommandForUser, waitForProcess) -import Distribution.Compat.CopyFile - ( copyFile, copyOrdinaryFile, copyExecutableFile - , setFileOrdinary, setFileExecutable, setDirOrdinary ) -import Distribution.Compat.Internal.TempFile - ( openTempFile, createTempDirectory ) -import Distribution.Compat.Exception - ( tryIO, catchIO, catchExit ) -import Distribution.Verbosity - -#ifdef VERSION_base -import qualified Paths_Cabal (version) -#endif -- We only get our own version number when we're building with ourselves cabalVersion :: Version @@ -1438,11 +1431,5 @@ listUnionRight a b = ordNubRight (filter (`Set.notMember` bSet) a) ++ b equating :: Eq a => (b -> a) -> b -> b -> Bool equating p x y = p x == p y -comparing :: Ord a => (b -> a) -> b -> b -> Ordering -comparing p x y = p x `compare` p y - -isInfixOf :: String -> String -> Bool -isInfixOf needle haystack = any (isPrefixOf needle) (tails haystack) - lowercase :: String -> String lowercase = map Char.toLower diff --git a/Cabal/Distribution/System.hs b/Cabal/Distribution/System.hs index 2ada6c185ef..f9b6baae28b 100644 --- a/Cabal/Distribution/System.hs +++ b/Cabal/Distribution/System.hs @@ -38,13 +38,14 @@ module Distribution.System ( import qualified System.Info (os, arch) import qualified Data.Char as Char (toLower, isAlphaNum, isAlpha) +import Distribution.Compat.Binary +import Distribution.Text +import qualified Distribution.Compat.ReadP as Parse + import Control.Monad (liftM2) -import Distribution.Compat.Binary (Binary) import Data.Data (Data) import Data.Typeable (Typeable) import Data.Maybe (fromMaybe, listToMaybe) -import Distribution.Text (Text(..), display) -import qualified Distribution.Compat.ReadP as Parse import GHC.Generics (Generic) import qualified Text.PrettyPrint as Disp import Text.PrettyPrint ((<>)) diff --git a/Cabal/Distribution/Utils/NubList.hs b/Cabal/Distribution/Utils/NubList.hs index 4b14306aad5..086df407b2b 100644 --- a/Cabal/Distribution/Utils/NubList.hs +++ b/Cabal/Distribution/Utils/NubList.hs @@ -12,8 +12,7 @@ module Distribution.Utils.NubList import Distribution.Compat.Semigroup as Semi import Distribution.Compat.Binary - -import Distribution.Simple.Utils (ordNub, listUnion, ordNubRight, listUnionRight) +import Distribution.Simple.Utils import qualified Text.Read as R diff --git a/Cabal/Distribution/Verbosity.hs b/Cabal/Distribution/Verbosity.hs index 8e0a6ffbc9f..1c51b50a60b 100644 --- a/Cabal/Distribution/Verbosity.hs +++ b/Cabal/Distribution/Verbosity.hs @@ -24,9 +24,10 @@ module Distribution.Verbosity ( showForCabal, showForGHC ) where -import Distribution.Compat.Binary (Binary) -import Data.List (elemIndex) +import Distribution.Compat.Binary import Distribution.ReadE + +import Data.List (elemIndex) import GHC.Generics data Verbosity = Silent | Normal | Verbose | Deafening diff --git a/Cabal/Distribution/Version.hs b/Cabal/Distribution/Version.hs index 7e0d804d842..5541fcd5c3b 100644 --- a/Cabal/Distribution/Version.hs +++ b/Cabal/Distribution/Version.hs @@ -99,9 +99,10 @@ import Data.Typeable ( Typeable ) import Data.Version ( Version(..) ) import GHC.Generics ( Generic ) -import Distribution.Text ( Text(..) ) +import Distribution.Text import qualified Distribution.Compat.ReadP as Parse -import Distribution.Compat.ReadP ((+++)) +import Distribution.Compat.ReadP hiding (get) + import qualified Text.PrettyPrint as Disp import Text.PrettyPrint ((<>), (<+>)) import qualified Data.Char as Char (isDigit) diff --git a/Cabal/Language/Haskell/Extension.hs b/Cabal/Language/Haskell/Extension.hs index 755cc27f82c..23651e3f843 100644 --- a/Cabal/Language/Haskell/Extension.hs +++ b/Cabal/Language/Haskell/Extension.hs @@ -22,12 +22,13 @@ module Language.Haskell.Extension ( deprecatedExtensions ) where -import Distribution.Text (Text(..)) +import Distribution.Text import qualified Distribution.Compat.ReadP as Parse +import Distribution.Compat.Binary + import qualified Text.PrettyPrint as Disp import qualified Data.Char as Char (isAlphaNum) import Data.Array (Array, accumArray, bounds, Ix(inRange), (!)) -import Distribution.Compat.Binary (Binary) import Data.Data (Data) import Data.Typeable (Typeable) import GHC.Generics (Generic)