hpack 0.39.4 → 0.39.5
raw patch · 5 files changed
+23/−10 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- hpack.cabal +2/−2
- resources/test/hpack.cabal +2/−2
- src/Hpack/Syntax/Dependencies.hs +11/−6
- test/Hpack/Syntax/DependenciesSpec.hs +3/−0
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Changes in 0.39.5+ - When rendering build dependencies in a Cabal file, Hpack no longer excludes+ the reference to the main library from the shorthand syntax such as+ `my-package:{my-package,my-library1,mylibrary2}`.+ ## Changes in 0.39.4 - Remove upper on `crypton`
hpack.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.39.1.+-- This file has been generated from package.yaml by hpack version 0.38.3. -- -- see: https://github.com/sol/hpack name: hpack-version: 0.39.4+version: 0.39.5 synopsis: A modern format for Haskell packages description: See the README at <https://github.com/sol/hpack#readme> category: Development
resources/test/hpack.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.0 --- This file has been generated from package.yaml by hpack version 0.39.1.+-- This file has been generated from package.yaml by hpack version 0.38.3. -- -- see: https://github.com/sol/hpack name: hpack-version: 0.39.4+version: 0.39.5 synopsis: A modern format for Haskell packages description: See the README at <https://github.com/sol/hpack#readme> category: Development
src/Hpack/Syntax/Dependencies.hs view
@@ -73,10 +73,15 @@ parseDependency subject = fmap fromCabal . cabalParse subject . T.unpack where fromCabal :: D.Dependency -> (String, DependencyVersion)- fromCabal d = (toName (D.depPkgName d) (DependencySet.toList $ D.depLibraries d), DependencyVersion Nothing . versionConstraintFromCabal $ D.depVerRange d)+ fromCabal (D.Dependency pkgName verRange libraries) =+ (depName, DependencyVersion Nothing $ versionConstraintFromCabal verRange)+ where+ depName :: String+ depName = prettyShow pkgName <> case DependencySet.toList libraries of+ [D.LMainLibName] -> ""+ [D.LSubLibName name] -> ":" <> prettyShow name+ xs -> ":{" <> intercalate "," (map renderComponent xs) <> "}" - toName :: D.PackageName -> [D.LibraryName] -> String- toName package components = prettyShow package <> case components of- [D.LMainLibName] -> ""- [D.LSubLibName lib] -> ":" <> prettyShow lib- xs -> ":{" <> (intercalate "," $ map prettyShow [name | D.LSubLibName name <- xs]) <> "}"+ renderComponent :: D.LibraryName -> String+ renderComponent D.LMainLibName = prettyShow pkgName+ renderComponent (D.LSubLibName name) = prettyShow name
test/Hpack/Syntax/DependenciesSpec.hs view
@@ -29,6 +29,9 @@ it "accepts dependencies with multiple subcomponents" $ do parseDependency "dependency" "foo:{bar,baz}" `shouldReturn` ("foo:{bar,baz}", DependencyVersion Nothing AnyVersion) + it "accepts dependencies with multiple subcomponents including the main library" $ do+ parseDependency "dependency" "foo:{foo,bar,baz}" `shouldReturn` ("foo:{foo,bar,baz}", DependencyVersion Nothing AnyVersion)+ describe "fromValue" $ do context "when parsing Dependencies" $ do context "with a scalar" $ do