diff --git a/Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs b/Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs index 2665b49a6de..a5716457792 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs @@ -1,6 +1,6 @@ module UnitTests.Distribution.PackageDescription.Check (tests) where -import Distribution.Compat.Prelude.Internal +import Distribution.Compat.Prelude import Prelude () import Distribution.PackageDescription.Check diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index 47757ea1543..ce5473b0f32 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -696,9 +696,9 @@ computeLocalBuildConfig cfg comp programDb = do data PackageInfo = PackageInfo { internalPackageSet :: Set LibraryName - , promisedDepsSet :: Map (PackageName, ComponentName) ComponentId + , promisedDepsSet :: Map (PackageName, ComponentName, Maybe PrivateAlias) ComponentId , installedPackageSet :: InstalledPackageIndex - , requiredDepsMap :: Map (PackageName, ComponentName) InstalledPackageInfo + , requiredDepsMap :: Map (PackageName, ComponentName, Maybe PrivateAlias) InstalledPackageInfo } configurePackage diff --git a/Cabal/src/Distribution/Types/LocalBuildInfo.hs b/Cabal/src/Distribution/Types/LocalBuildInfo.hs index 1c3aeef0161..7124216957f 100644 --- a/Cabal/src/Distribution/Types/LocalBuildInfo.hs +++ b/Cabal/src/Distribution/Types/LocalBuildInfo.hs @@ -151,7 +151,7 @@ pattern LocalBuildInfo -> Maybe FilePath -> Graph ComponentLocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo] - -> Map (PackageName, ComponentName) ComponentId + -> Map (PackageName, ComponentName, Maybe PrivateAlias) ComponentId -> InstalledPackageIndex -> PackageDescription -> ProgramDb diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs b/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs index 1c962e9672a..278b8d358c9 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs @@ -561,8 +561,6 @@ convLibDepsAs :: DependencyReason PN -> PrivateDependency -> [LDep PN] convLibDepsAs dr (PrivateDependency alias deps) = [ LDep dr $ Dep (PkgComponent pn (ExposedLib lib)) (Private alias) (Constrained vr) | Dependency pn vr libs <- deps, lib <- NonEmptySet.toList libs ] - where - -- | Convert a Cabal dependency on an executable (build-tools) to a solver-specific dependency. convExeDep :: DependencyReason PN -> ExeDependency -> LDep PN diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs b/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs index bd24d4b6cfd..d2fc113e21e 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs @@ -176,7 +176,7 @@ instance IsNode NonSetupLibDepSolverPlanPackage where nodeKey spkg nodeNeighbors (NonSetupLibDepSolverPlanPackage spkg) = - ordNub $ (map fst $ CD.nonSetupDeps (resolverPackageLibDeps spkg)) + ordNub $ map fst (CD.nonSetupDeps (resolverPackageLibDeps spkg)) -- | Work out which version of the Cabal we will be using to talk to the -- Setup.hs interface for this package. diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ScriptUtils.hs b/cabal-install/tests/UnitTests/Distribution/Client/ScriptUtils.hs index 42485d4ae8c..3a365d5b8ae 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ScriptUtils.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ScriptUtils.hs @@ -29,9 +29,8 @@ testScriptPath (ShortPath p) = withMaxSuccess 10000 $ ioProperty $ do hashed_path <- getScriptCacheDirectory p script_build_dir <- defaultScriptBuildsDir return $ - and - -- 1. Is it a valid path at all - [ isValid hashed_path - , -- 2. Is the computed hashed path in the expected directory? - (script_build_dir takeFileName hashed_path) `equalFilePath` hashed_path - ] + -- 1. Is it a valid path at all + isValid hashed_path + && + -- 2. Is the computed hashed path in the expected directory? + (script_build_dir takeFileName hashed_path) `equalFilePath` hashed_path diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs index f7c7348607e..f7db773d373 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs @@ -97,7 +97,6 @@ import Distribution.Solver.Types.Settings import Distribution.Solver.Types.SolverPackage import Distribution.Solver.Types.SourcePackage import Distribution.Solver.Types.Variable -import Distribution.Types.Dependency (PrivateAlias) {------------------------------------------------------------------------------- Example package database DSL @@ -680,6 +679,7 @@ exAvSrcPkg ex = mkDirectD :: (ExamplePkgName, C.LibraryName, C.VersionRange, Maybe ExamplePrivateAlias) -> C.PrivateDependency mkDirectD (dep, name, vr, Just alias) = C.PrivateDependency (C.PrivateAlias (fromString alias)) [C.Dependency (C.mkPackageName dep) vr (NonEmptySet.singleton name)] + mkDirectD (_, _, _, Nothing) = error "mkDirectD: private deps are never Nothing since we partition them by 'isJust' above" mkFlagged :: (C.LibraryVisibility -> C.BuildInfo -> a) diff --git a/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-exe/app/Main.hs b/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-exe/app/Main.hs index c4ab3b1d930..38dc9f85525 100644 --- a/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-exe/app/Main.hs +++ b/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-exe/app/Main.hs @@ -25,11 +25,11 @@ main = do "show" -> do s <- getContents let a1 :: A = decode s - res <- return $ show a1 + res = show a1 putStr (encode res) "inc" -> do s <- getContents let a1 :: A = decode s - res <- return $ inc a1 + res = inc a1 putStr (encode res) _ -> error "Hook not yet implemented" diff --git a/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-lib/src/HooksLib.hs b/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-lib/src/HooksLib.hs index 038f00bdac9..aae813b46f5 100644 --- a/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-lib/src/HooksLib.hs +++ b/cabal-testsuite/PackageTests/PrivateDeps/cabal-hooks-demo/hooks-lib/src/HooksLib.hs @@ -68,14 +68,14 @@ revertA2 L2.B = L.B hooks_show :: L.A -> HooksM String hooks_show a = do - ver <- hooksVersion <$> ask + ver <- asks hooksVersion case ver of V01 -> readHooksExe "show" (convertA1 a) V02 -> readHooksExe "show" (convertA2 a) hooks_inc :: L.A -> HooksM L.A hooks_inc a = do - ver <- hooksVersion <$> ask + ver <- asks hooksVersion case ver of V01 -> revertA1 <$> (readHooksExe "inc" (convertA1 a)) V02 -> revertA2 <$> (readHooksExe "inc" (convertA2 a)) @@ -88,7 +88,7 @@ hooks_inc a = do readHooksExe :: (Binary a, Binary b) => String -> a -> HooksM b readHooksExe hook args = do - exe <- hooksExe <$> ask + exe <- asks hooksExe liftIO $ readHooksExe_ exe hook args withForkWait :: IO () -> (IO () -> IO a) -> IO a diff --git a/cabal-testsuite/src/Test/Cabal/Prelude.hs b/cabal-testsuite/src/Test/Cabal/Prelude.hs index 91dd7793db1..28f853e2aaf 100644 --- a/cabal-testsuite/src/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/src/Test/Cabal/Prelude.hs @@ -1174,7 +1174,7 @@ findDependencyInStore :: String -- ^package name prefix findDependencyInStore pkgName = do storeDir <- testStoreDir <$> getTestEnv liftIO $ do - storeDirForGhcVersion <- head <$> listDirectory storeDir + (storeDirForGhcVersion:_) <- listDirectory storeDir packageDirs <- listDirectory (storeDir storeDirForGhcVersion) -- Ideally, we should call 'hashedInstalledPackageId' from 'Distribution.Client.PackageHash'. -- But 'PackageHashInputs', especially 'PackageHashConfigInputs', is too hard to construct.