packages feed

cabal-fmt 0.1.7 → 0.1.9

raw patch · 6 files changed

+44/−34 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Changelog.md view
@@ -1,3 +1,12 @@+# 0.1.9++- Change how version ranges with carets are formatted once again.+  Now `^>=1.2 || ^>=1.3` won't be changed anymore.++# 0.1.8++- Order extensions lexicographically+ # 0.1.7  - Use Cabal-syntax-3.10.1.0
cabal-fmt.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.2 name:               cabal-fmt-version:            0.1.7+version:            0.1.9 synopsis:           Format .cabal files category:           Development description:@@ -52,7 +52,7 @@     , containers    ^>=0.5.11.0 || ^>=0.6.0.1     , directory     ^>=1.3.1.5     , filepath      ^>=1.4.2-    , mtl           ^>=2.2.2 || ^>=2.3.1+    , mtl           ^>=2.2.2    || ^>=2.3.1     , parsec        ^>=3.1.13.0     , pretty        ^>=1.1.3.6 
fixtures/tree-diff.format view
@@ -92,7 +92,7 @@     , parsec      ^>=3.1.13.0     , pretty      ^>=1.1.1.0     , text        ^>=1.2.3.0  || ^>=2.0-    , time        ^>=1.4      || ^>=1.5.0.1  || ^>=1.6.0.1  || ^>=1.8.0.2 || >=1.9.3 && <1.12 || ^>=1.12+    , time        ^>=1.4      || ^>=1.5.0.1  || ^>=1.6.0.1  || ^>=1.8.0.2 || ^>=1.9.3 || ^>=1.10 || ^>=1.11 || ^>=1.12    build-depends:     , aeson                 ^>=1.4.6.0    || ^>=1.5.6.0  || ^>=2.0.0.0 || ^>=2.1.0.0
src-interval/VersionInterval.hs view
@@ -402,37 +402,38 @@     makeUpperBound u = earlierVersion u  intervalToVersionRange2 :: LB -> MB -> Maybe (NonEmpty VersionRange)-intervalToVersionRange2 (LB l) major = case major of-    NoMB -> Just (singleton lowerBound)-    MB m-        | majorUpperBound l == m-        -> Just (singleton (majorBoundVersion l))--{--    MB m-        | [a,b]  <- versionNumbers m-        , a' : _ <- versionNumbers l-        , a' == a-        , b >= 1-        , majorUpperBound l <= m-        -> Just $ go (majorBoundVersion l :|) (majorUpperBound l)-      where-        go acc v = if v >= m then acc [] else go (acc . (majorBoundVersion v :)) (majorUpperBound v)--}+intervalToVersionRange2 (LB l) NoMB = Just (singleton lowerBound)+  where+    lowerBound :: VersionRange+    lowerBound = lbToVR (LB l)+intervalToVersionRange2 (LB l) (MB m)+    | supermajor l == supermajor m+    = go (l :|) (majorUpperBound l) -    MB m-        | [a,b] <- versionNumbers m-        , let m' = mkVersion [a,b-1]-        , b >= 1-        , m' > l-        -> Just $+    | [a,b] <- versionNumbers m+    , let m' = mkVersion [a,b-1]+    , b >= 1+    , m' > l+    = Just $             (ubToVR (UB m') (lbToVR (LB l)))             :| [ majorBoundVersion (mkVersion [a, b-1]) ] -    _ -> Nothing+    | otherwise+    = Nothing+   where-    lowerBound :: VersionRange-    lowerBound = lbToVR (LB l)+    go :: ([Version] -> NonEmpty Version) -> Version -> Maybe (NonEmpty VersionRange)+    go !acc v = case compare v m of+        LT -> go (snoc acc v) (majorUpperBound v)+        EQ -> Just (fmap majorBoundVersion (acc []))+        GT -> Nothing++    snoc xs x = xs . (x :)++    supermajor :: Version -> Int+    supermajor v = case versionNumbers v of+        []  -> -1+        s:_ -> s  ------------------------------------------------------------------------------- -- Normalisation
src/CabalFmt/Fields/Extensions.hs view
@@ -5,7 +5,7 @@ module CabalFmt.Fields.Extensions (     otherExtensionsF,     defaultExtensionsF,-    ) where+) where  import qualified Distribution.FieldGrammar  as C import qualified Distribution.Parsec        as C@@ -26,4 +26,4 @@ parse = unpack' (C.alaList' C.FSep C.MQuoted) <$> C.parsec  pretty :: [C.Extension] -> PP.Doc-pretty = PP.vcat . map C.pretty . sortOn show+pretty = PP.vcat . map C.pretty . sortOn C.prettyShow
tests-interval/version-interval-tests.hs view
@@ -100,9 +100,9 @@         [ normaliseExample ">=1 && <2"                               ">=1 && <2"         , normaliseExample "^>=1"                                    "^>=1"         , normaliseExample "^>=1 || ^>=2"                            "^>=1 || ^>=2"-        , normaliseExample "^>=1.2 || ^>=1.3 || ^>=1.4"              ">=1.2 && <1.4 || ^>=1.4"+        , normaliseExample "^>=1.2 || ^>=1.3 || ^>=1.4"              "^>=1.2 || ^>=1.3 || ^>=1.4"         , normaliseExample "^>=1.2 || ^>=2.0"                        "^>=1.2 || ^>=2.0"-        , normaliseExample ">=1.2 && <1.4 || ^>=1.4 || ^>=1.5"       ">=1.2 && <1.5 || ^>=1.5"+        , normaliseExample ">=1.2 && <1.4 || ^>=1.4 || ^>=1.5"       "^>=1.2 || ^>=1.3 || ^>=1.4 || ^>=1.5"         , normaliseExample ">=1.2 && <2.4 || ^>=2.4 || ^>=2.5"       ">=1.2 && <2.5 || ^>=2.5"         , normaliseExample "^>=1.2.0.0 || ^>=1.3.0.0 || ^>=1.4.0.0"  "^>=1.2.0.0 || ^>=1.3.0.0 || ^>=1.4.0.0" @@ -120,7 +120,7 @@         , normaliseExample ">0 && <0.0"    "<0"          , normaliseExample "^>=1.5.0.1 || ^>=1.6.0.1 || >=1.9 && <1.13"-                           "^>=1.5.0.1 || ^>=1.6.0.1 || >=1.9 && <1.12 || ^>=1.12"+                           "^>=1.5.0.1 || ^>=1.6.0.1 || ^>=1.9 || ^>=1.10 || ^>=1.11 ||^>=1.12"          , cannotNormaliseExample "^>=0 && >=0.1" IntervalsEmpty