packages feed

aeson-better-errors 0.9.1.0 → 0.9.1.1

raw patch · 3 files changed

+29/−2 lines, 3 filesdep ~aesonPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson

API changes (from Hackage documentation)

- Data.Aeson.BetterErrors: BadSchema :: [PathPiece] -> (ErrorSpecifics err) -> ParseError err
+ Data.Aeson.BetterErrors: BadSchema :: [PathPiece] -> ErrorSpecifics err -> ParseError err
- Data.Aeson.BetterErrors.Internal: BadSchema :: [PathPiece] -> (ErrorSpecifics err) -> ParseError err
+ Data.Aeson.BetterErrors.Internal: BadSchema :: [PathPiece] -> ErrorSpecifics err -> ParseError err
- Data.Aeson.BetterErrors.Internal: ParseT :: (ReaderT ParseReader (ExceptT (ParseError err) m) a) -> ParseT err m a
+ Data.Aeson.BetterErrors.Internal: ParseT :: ReaderT ParseReader (ExceptT (ParseError err) m) a -> ParseT err m a

Files

+ CHANGELOG.md view
@@ -0,0 +1,10 @@+# Revision history for aeson-better-errors++## 0.9.1.1++* Make compatible with aeson >2.0.0.0+++## Previous versions++* Please see git history
aeson-better-errors.cabal view
@@ -1,5 +1,5 @@ name:                aeson-better-errors-version:             0.9.1.0+version:             0.9.1.1 synopsis:            Better error messages when decoding JSON values. license:             MIT license-file:        LICENSE@@ -10,6 +10,7 @@ build-type:          Simple cabal-version:       >=1.10 extra-source-files:  README.md+                   , CHANGELOG.md  description:   A small package which gives you the tools to build parsers to decode JSON@@ -26,7 +27,7 @@                      Data.Aeson.BetterErrors.Internal   other-modules:     Data.Aeson.BetterErrors.Utils   build-depends:     base >=4.5 && <5-                   , aeson >=0.7+                   , aeson >=0.7 && <1.6 || >=2.0 && <2.1                    , unordered-containers                    , dlist                    , text
src/Data/Aeson/BetterErrors/Internal.hs view
@@ -33,7 +33,13 @@ import qualified Data.Vector as V import Data.Scientific (Scientific) import qualified Data.Scientific as S++#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.KeyMap as KeyMap+import qualified Data.Aeson.Key as Key+#else import qualified Data.HashMap.Strict as HashMap+#endif  import Data.Aeson.BetterErrors.Utils @@ -387,7 +393,11 @@   v <- asks rdrValue   case v of     A.Object obj ->+#if MIN_VERSION_aeson(2,0,0)+      case KeyMap.lookup (Key.fromText k) obj of+#else       case HashMap.lookup k obj of+#endif         Just v' ->           local (appendPath (ObjectKey k) . setValue v') p         Nothing ->@@ -435,9 +445,15 @@ -- an argument, and collect the results. forEachInObject :: (Functor m, Monad m) => (Text -> ParseT err m a) -> ParseT err m [a] forEachInObject p = do+#if MIN_VERSION_aeson(2,0,0)+  xs <- KeyMap.toList <$> asObject+  forM xs $ \(k, x) ->+    local (appendPath (ObjectKey (Key.toText k)) . setValue x) (p (Key.toText k))+#else   xs <- HashMap.toList <$> asObject   forM xs $ \(k, x) ->     local (appendPath (ObjectKey k) . setValue x) (p k)+#endif  -- | Attempt to parse each property value in the object with the given parser, -- and collect the results.