From 9b856f62ace52976c7bd361051b8686521eb091a Mon Sep 17 00:00:00 2001 From: Duncan Coutts Date: Sat, 26 Nov 2016 23:58:09 +0000 Subject: [PATCH] A few minor BuildTarget code tweaks Comments, error messages and updated example inputs. --- .../Distribution/Client/BuildTarget.hs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cabal-install/Distribution/Client/BuildTarget.hs b/cabal-install/Distribution/Client/BuildTarget.hs index 673c89546f4..1fe25b1c217 100644 --- a/cabal-install/Distribution/Client/BuildTarget.hs +++ b/cabal-install/Distribution/Client/BuildTarget.hs @@ -665,6 +665,8 @@ reportBuildTargetProblems problems = do [ "Unknown build target '" ++ showUserBuildTarget target ++ "'.\n" ++ unlines [ (case inside of + Just (kind, "") + -> "The " ++ kind ++ " has no " Just (kind, thing) -> "The " ++ kind ++ " " ++ thing ++ " has no " Nothing -> "There is no ") @@ -1663,6 +1665,8 @@ forceInexact m = m -- but if we have multiple exact, or inexact then the we collect all the -- ambiguous matches. -- +-- This operator is associative, has unit 'mzero' and is also commutative. +-- matchPlus :: Match a -> Match a -> Match a matchPlus (ExactMatch d1 xs) (ExactMatch d2 xs') = ExactMatch (max d1 d2) (xs ++ xs') @@ -1683,6 +1687,8 @@ matchPlus a@(NoMatch d1 ms) b@(NoMatch d2 ms') -- difference that an exact match from the left matcher shadows any exact -- match on the right. Inexact matches are still collected however. -- +-- This operator is associative, has unit 'mzero' and is not commutative. +-- matchPlusShadowing :: Match a -> Match a -> Match a matchPlusShadowing a@(ExactMatch _ _) _ = a matchPlusShadowing a b = matchPlus a b @@ -1812,7 +1818,8 @@ caseFold = lowercase {- ex1pinfo :: [PackageInfo] ex1pinfo = - [ PackageInfo { + [ addComponent (CExeName (mkUnqualComponentName "foo-exe")) [] ["Data.Foo"] $ + PackageInfo { pinfoId = PackageIdentifier (mkPackageName "foo") (mkVersion [1]), pinfoLocation = LocalUnpackedPackage "/the/foo", pinfoDirectory = Just ("/the/foo", "foo"), @@ -1827,6 +1834,18 @@ ex1pinfo = pinfoComponents = [] } ] + where + addComponent n ds ms p = + p { + pinfoComponents = + ComponentInfo n (componentStringName (pinfoId p) n) + p ds (map mkMn ms) + [] [] [] + : pinfoComponents p + } + + mkMn :: String -> ModuleName + mkMn = ModuleName.fromString -} {- stargets =