Skip to content

Commit

Permalink
A few minor BuildTarget code tweaks
Browse files Browse the repository at this point in the history
Comments, error messages and updated example inputs.
  • Loading branch information
dcoutts committed Nov 26, 2016
1 parent 9cb29dc commit 9b856f6
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion cabal-install/Distribution/Client/BuildTarget.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ")
Expand Down Expand Up @@ -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')
Expand All @@ -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
Expand Down Expand Up @@ -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"),
Expand All @@ -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 =
Expand Down

0 comments on commit 9b856f6

Please sign in to comment.