diff --git a/Cabal-described/src/Distribution/Described.hs b/Cabal-described/src/Distribution/Described.hs index b158fe02a77..1e737b365ba 100644 --- a/Cabal-described/src/Distribution/Described.hs +++ b/Cabal-described/src/Distribution/Described.hs @@ -76,7 +76,7 @@ import Distribution.Types.AbiDependency (AbiDependency) import Distribution.Types.AbiHash (AbiHash) import Distribution.Types.BenchmarkType (BenchmarkType) import Distribution.Types.BuildType (BuildType) -import Distribution.Types.Dependency (Dependency) +import Distribution.Types.Dependency (Dependency, PrivateAlias(..)) import Distribution.Types.ExecutableScope (ExecutableScope) import Distribution.Types.ExeDependency (ExeDependency) import Distribution.Types.ExposedModule (ExposedModule) @@ -446,6 +446,9 @@ instance Described ModuleName where describe _ = REMunch1 (reChar '.') component where component = RECharSet csUpper <> REMunch reEps (REUnion [RECharSet csAlphaNum, RECharSet (fromString "_'")]) +instance Described PrivateAlias where + describe _ = describe (Proxy :: Proxy ModuleName) + instance Described ModuleReexport where describe _ = RETodo @@ -591,4 +594,4 @@ instance Described CompatLicenseFile where describe _ = describe ([] :: [Token]) instance Described CompatFilePath where - describe _ = describe ([] :: [Token]) \ No newline at end of file + describe _ = describe ([] :: [Token]) diff --git a/Cabal-tests/tests/CheckTests.hs b/Cabal-tests/tests/CheckTests.hs index 220cc7d1458..aa2f1e9b041 100644 --- a/Cabal-tests/tests/CheckTests.hs +++ b/Cabal-tests/tests/CheckTests.hs @@ -3,7 +3,6 @@ module Main ) where import Test.Tasty -import Test.Tasty.ExpectedFailure import Test.Tasty.Golden.Advanced (goldenTest) import Data.Algorithm.Diff (PolyDiff (..), getGroupedDiff) 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..fa42dcfc500 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 @@ -293,12 +292,10 @@ data ExampleQualifier = QualNone | QualIndep ExamplePkgName | QualSetup ExamplePkgName - | -- The two package names are the build target and the package containing the - -- setup script. - QualIndepSetup ExamplePkgName ExamplePkgName | -- The two package names are the package depending on the exe and the -- package containing the exe. QualExe ExamplePkgName ExamplePkgName + -- ROMES:TODO: Add QualPrivateAlias? -- | Whether to enable tests in all packages in a test case. newtype EnableAllTests = EnableAllTests Bool @@ -680,6 +677,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-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs index debbfa77563..4a1530d5214 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs @@ -321,12 +321,6 @@ runTest SolverTest{..} = askOption $ \(OptionShowSolverLog showSolverLog) -> P.PackagePath (P.IndependentComponent (C.mkPackageName s) C.ComponentSetup) (P.QualToplevel) - {- - QualIndepSetup p s -> - P.PackagePath - (P.Independent $ C.mkPackageName p) - (P.QualSetup (C.mkPackageName s)) - -} QualExe p1 p2 -> P.PackagePath (P.IndependentBuildTool (C.mkPackageName p1) (C.mkPackageName p2)) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs index 7b221e671ea..b408b2526ba 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs @@ -24,6 +24,8 @@ import Distribution.Utils.ShortText (ShortText) import Distribution.Client.Setup (defaultMaxBackjumps) +import Distribution.Types.Dependency (PrivateAlias(..)) +import Distribution.ModuleName import Distribution.Types.LibraryVisibility import Distribution.Types.PackageName import Distribution.Types.UnqualComponentName @@ -626,6 +628,9 @@ instance Hashable OptionalStanza instance Hashable FlagName instance Hashable PackageName instance Hashable ShortText +instance Hashable ModuleName +instance Hashable PrivateAlias + deriving instance Generic (Variable pn) deriving instance Generic (P.Qualified 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.