configuration-tools 0.6.0 → 0.6.1
raw patch · 6 files changed
+58/−11 lines, 6 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- Setup.hs +12/−2
- configuration-tools.cabal +3/−3
- src/Configuration/Utils/ConfigFile.hs +21/−5
- src/Configuration/Utils/Internal/JsonTools.hs +5/−0
- src/Configuration/Utils/Setup.hs +12/−1
CHANGELOG.md view
@@ -1,5 +1,10 @@ # configuration-tools +## 0.6.1 (2021-10-12)++* Support GHC-9.2+* Support aeson >=2.0+ ## 0.6.0 (2021-02-16) #### New
Setup.hs view
@@ -111,9 +111,12 @@ import Distribution.Simple.PackageIndex import Distribution.Simple.Setup import Distribution.Text-import Distribution.Types.LocalBuildInfo import Distribution.Types.UnqualComponentName +#if MIN_VERSION_Cabal(3,6,0)+import Distribution.Utils.Path+#endif+ #if MIN_VERSION_Cabal(3,2,0) import Distribution.Utils.ShortText #endif@@ -373,12 +376,19 @@ licenseFilesText :: PackageDescription -> IO B.ByteString licenseFilesText pkgDesc =- B.intercalate "\n------------------------------------------------------------\n" <$> mapM fileText+ B.intercalate "\n------------------------------------------------------------\n" <$> mapM fileTextStr (licenseFiles pkgDesc) where fileText file = doesFileExist file >>= \x -> if x then B.readFile file else return ""++#if MIN_VERSION_Cabal(3,6,0)+ fileTextStr = fileText . getSymbolicPath+#else+ fileTextStr = fileText+#endif+ hgInfo :: IO (String, String, String) hgInfo = do
configuration-tools.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: configuration-tools-version: 0.6.0+version: 0.6.1 synopsis: Tools for specifying and parsing configurations description: Tools for specifying and parsing configurations@@ -38,9 +38,9 @@ category: Configuration, Console build-type: Custom tested-with:- GHC==8.10.4+ GHC==9.0.1+ , GHC==8.10.7 , GHC==8.8.4- , GHC==8.6.5 extra-doc-files: README.md,
src/Configuration/Utils/ConfigFile.hs view
@@ -68,7 +68,12 @@ import Data.Aeson.Types (Parser) import Data.Char import Data.Foldable+#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key as K+import qualified Data.Aeson.KeyMap as H+#else import qualified Data.HashMap.Strict as H+#endif import Data.Maybe import Data.Monoid.Unicode import Data.String@@ -82,6 +87,17 @@ import Configuration.Utils.Operators #endif +-- -------------------------------------------------------------------------- --+-- Compatibility++#if MIN_VERSION_aeson(2,0,0)+fromText ∷ T.Text → Key+fromText = K.fromText+#else+fromText ∷ T.Text → T.Text+fromText = id+#endif+ -- | A JSON 'Value' parser for a property of a given -- 'Object' that updates a setter with the parsed value. --@@ -115,7 +131,7 @@ → (Value → Parser b) -- ^ the JSON 'Value' parser that is used to parse the value of the property → Object -- ^ the parsed JSON 'Value' 'Object' → Parser (a → a)-setProperty s k p o = case H.lookup k o of+setProperty s k p o = case H.lookup (fromText k) o of Nothing → pure id Just v → set s <$> p v @@ -183,7 +199,7 @@ → (Value → Parser (b → b)) → Object → Parser (a → a)-updateProperty s k p o = case H.lookup k o of+updateProperty s k p o = case H.lookup (fromText k) o of Nothing → pure id Just v → over s <$> p v {-# INLINE updateProperty #-}@@ -229,7 +245,7 @@ → T.Text → Object → Parser (a → a)-(!..:) l property o = set l <$> (o .: property)+(!..:) l property o = set l <$> (o .: fromText property) {-# INLINE (!..:) #-} -- -------------------------------------------------------------------------- --@@ -278,5 +294,5 @@ dropAndUncaml ∷ Int → String → String dropAndUncaml _ "" = "" dropAndUncaml i l = case drop i l of- [] -> l- (h:t) -> toLower h : concatMap (\x → if isUpper x then "-" ⊕ [toLower x] else [x]) t+ [] → l+ (h:t) → toLower h : concatMap (\x → if isUpper x then "-" ⊕ [toLower x] else [x]) t
src/Configuration/Utils/Internal/JsonTools.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-}@@ -38,7 +39,11 @@ import Data.Aeson import Data.Aeson.Types import Data.Foldable+#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.KeyMap as HM+#else import qualified Data.HashMap.Strict as HM+#endif import qualified Data.Vector as V import GHC.Generics
src/Configuration/Utils/Setup.hs view
@@ -113,6 +113,10 @@ import Distribution.Text import Distribution.Types.UnqualComponentName +#if MIN_VERSION_Cabal(3,6,0)+import Distribution.Utils.Path+#endif+ #if MIN_VERSION_Cabal(3,2,0) import Distribution.Utils.ShortText #endif@@ -372,12 +376,19 @@ licenseFilesText :: PackageDescription -> IO B.ByteString licenseFilesText pkgDesc =- B.intercalate "\n------------------------------------------------------------\n" <$> mapM fileText+ B.intercalate "\n------------------------------------------------------------\n" <$> mapM fileTextStr (licenseFiles pkgDesc) where fileText file = doesFileExist file >>= \x -> if x then B.readFile file else return ""++#if MIN_VERSION_Cabal(3,6,0)+ fileTextStr = fileText . getSymbolicPath+#else+ fileTextStr = fileText+#endif+ hgInfo :: IO (String, String, String) hgInfo = do