aeson-combinators 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+23/−9 lines, 3 filesdep +attoparsec-aeson
Dependencies added: attoparsec-aeson
Files
- CHANGELOG.md +3/−0
- aeson-combinators.cabal +7/−3
- lib/Data/Aeson/Combinators/Decode.hs +13/−6
CHANGELOG.md view
@@ -1,5 +1,8 @@ # Revision history for aeson-combinators +## 0.1.1.0 -- 2023-12-28+* Aeson 2.2.x compatibility+ ## 0.1.1.0 -- 2023-09-03 * `fromDecoder` utility to unwrap a `Decoder`'s function * `maybeKey` combinator
aeson-combinators.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: aeson-combinators-version: 0.1.1.0+version: 0.1.2.0 synopsis: Aeson combinators for dead simple JSON decoding description: Low overhead value space `Decoder`@@ -18,10 +18,10 @@ extra-source-files: README.md , CHANGELOG.md homepage: https://github.com/turboMaCk/aeson-combinators-tested-with: GHC == 8.8.4- , GHC == 8.10.7+tested-with: GHC == 8.10.7 , GHC == 9.0.2 , GHC == 9.2.5+ , GHC == 9.8.1 , GHCJS == 8.6.0.1 Flag doctest@@ -48,6 +48,10 @@ , unordered-containers , void , scientific++ if impl(ghc >= 9.8.0)+ build-depends:+ attoparsec-aeson hs-source-dirs: lib default-language: Haskell2010 hs-source-dirs: lib
lib/Data/Aeson/Combinators/Decode.hs view
@@ -102,8 +102,15 @@ import qualified Control.Monad.Fail as Fail import Data.Aeson.Combinators.Compat++#if !(MIN_VERSION_aeson(2,2,0)) import Data.Aeson.Internal (JSONPath, JSONPathElement (..))-import qualified Data.Aeson.Internal as AI+import Data.Aeson.Internal (formatError, iparse)+#endif+#if MIN_VERSION_aeson(2,2,0)+import Data.Aeson.Types (JSONPath, JSONPathElement (..))+import Data.Aeson.Types (formatError, iparse)+#endif import qualified Data.Aeson.Parser as Parser import qualified Data.Aeson.Parser.Internal as ParserI import Data.Aeson.Types hiding (parseEither, parseMaybe)@@ -797,14 +804,14 @@ -- | Like 'decode' but returns an error message when decoding fails. eitherDecode :: Decoder a -> LB.ByteString -> Either String a eitherDecode (Decoder d) =- eitherFormatError . Parser.eitherDecodeWith ParserI.jsonEOF (AI.iparse d)+ eitherFormatError . Parser.eitherDecodeWith ParserI.jsonEOF (iparse d) {-# INLINE eitherDecode #-} -- | Like 'decode'' but returns an error message when decoding fails. eitherDecode' :: Decoder a -> LB.ByteString -> Either String a eitherDecode' (Decoder d) =- eitherFormatError . Parser.eitherDecodeWith ParserI.jsonEOF' (AI.iparse d)+ eitherFormatError . Parser.eitherDecodeWith ParserI.jsonEOF' (iparse d) {-# INLINE eitherDecode' #-} @@ -844,14 +851,14 @@ -- | Like 'decodeStrict' but returns an error message when decoding fails. eitherDecodeStrict :: Decoder a -> B.ByteString -> Either String a eitherDecodeStrict (Decoder d) =- eitherFormatError . Parser.eitherDecodeStrictWith ParserI.jsonEOF (AI.iparse d)+ eitherFormatError . Parser.eitherDecodeStrictWith ParserI.jsonEOF (iparse d) {-# INLINE eitherDecodeStrict #-} -- | Like 'decodeStrict'' but returns an error message when decoding fails. eitherDecodeStrict' :: Decoder a -> B.ByteString -> Either String a eitherDecodeStrict' (Decoder d) =- eitherFormatError . Parser.eitherDecodeStrictWith ParserI.jsonEOF' (AI.iparse d)+ eitherFormatError . Parser.eitherDecodeStrictWith ParserI.jsonEOF' (iparse d) {-# INLINE eitherDecodeStrict' #-} @@ -923,7 +930,7 @@ eitherFormatError :: Either (JSONPath, String) a -> Either String a-eitherFormatError = Prelude.either (Left . uncurry AI.formatError) Right+eitherFormatError = Prelude.either (Left . uncurry formatError) Right {-# INLINE eitherFormatError #-}