aeson-better-errors 0.5.0.0 → 0.6.0.0
raw patch · 3 files changed
+24/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Aeson.BetterErrors: displayError' :: ParseError' -> [Text]
+ Data.Aeson.BetterErrors: displaySpecifics' :: ErrorSpecifics' -> [Text]
+ Data.Aeson.BetterErrors: type ErrorSpecifics' = ErrorSpecifics Void
+ Data.Aeson.BetterErrors: type ParseError' = ParseError Void
+ Data.Aeson.BetterErrors.Internal: displayError' :: ParseError' -> [Text]
+ Data.Aeson.BetterErrors.Internal: displaySpecifics' :: ErrorSpecifics' -> [Text]
+ Data.Aeson.BetterErrors.Internal: type ErrorSpecifics' = ErrorSpecifics Void
+ Data.Aeson.BetterErrors.Internal: type ParseError' = ParseError Void
Files
- aeson-better-errors.cabal +1/−1
- src/Data/Aeson/BetterErrors.hs +4/−0
- src/Data/Aeson/BetterErrors/Internal.hs +19/−1
aeson-better-errors.cabal view
@@ -1,5 +1,5 @@ name: aeson-better-errors-version: 0.5.0.0+version: 0.6.0.0 synopsis: Better error messages when decoding JSON values. license: MIT license-file: LICENSE
src/Data/Aeson/BetterErrors.hs view
@@ -61,11 +61,15 @@ -- * Errors , ParseError(..)+ , ParseError' , PathPiece(..) , ErrorSpecifics(..)+ , ErrorSpecifics' , displayError+ , displayError' , displayPath , displaySpecifics+ , displaySpecifics' -- * Miscellaneous , toAesonParser
src/Data/Aeson/BetterErrors/Internal.hs view
@@ -135,6 +135,10 @@ | BadSchema [PathPiece] (ErrorSpecifics err) deriving (Show, Eq, Functor) +-- | The type of parse errors which never involve custom validation+-- errors.+type ParseError' = ParseError Void+ -- | Detailed information in the case where a value could be parsed as JSON, -- but a value of the required type could not be constructed from it, for some -- reason.@@ -146,6 +150,10 @@ | CustomError err deriving (Show, Eq, Functor) +-- | The type of error specifics which never involve custom validation+-- errors.+type ErrorSpecifics' = ErrorSpecifics Void+ -- | An enumeration of the different types that JSON values may take. data JSONType = TyObject@@ -176,6 +184,11 @@ displayError f (BadSchema path specs) = [ "At the path: " <> displayPath path ] <> displaySpecifics f specs +-- | A version of 'displayError' for parsers which do not produce custom+-- validation errors.+displayError' :: ParseError' -> [Text]+displayError' = displayError absurd+ displayPath :: [PathPiece] -> Text displayPath = foldMap showPiece where@@ -197,6 +210,11 @@ displaySpecifics f (CustomError err) = [ f err ] +-- | A version of `displaySpecifics` for parsers which do not produce+-- custom validation errors.+displaySpecifics' :: ErrorSpecifics' -> [Text]+displaySpecifics' = displaySpecifics absurd+ -- | Get the type of a JSON value. jsonTypeOf :: A.Value -> JSONType jsonTypeOf (A.Object _) = TyObject@@ -393,7 +411,7 @@ withBool :: (Bool -> Either err a) -> Parse err a withBool = with asBool --- | Prefer to use functions like 'key or 'eachInObject' to this one where+-- | Prefer to use functions like 'key' or 'eachInObject' to this one where -- possible, as they will generate better error messages. withObject :: (A.Object -> Either err a) -> Parse err a withObject = with asObject