packages feed

aeson-better-errors 0.9.0.1 → 0.9.1.0

raw patch · 3 files changed

+11/−11 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Aeson.BetterErrors: (<|>) :: Monad m => ParseT err m a -> ParseT err m a -> ParseT err m a
+ Data.Aeson.BetterErrors: infixl 3 <|>
+ Data.Aeson.BetterErrors.Internal: (<|>) :: Monad m => ParseT err m a -> ParseT err m a -> ParseT err m a
+ Data.Aeson.BetterErrors.Internal: infixl 3 <|>
+ Data.Aeson.BetterErrors.Internal: instance GHC.Enum.Bounded Data.Aeson.BetterErrors.Internal.JSONType
+ Data.Aeson.BetterErrors.Internal: instance GHC.Enum.Enum Data.Aeson.BetterErrors.Internal.JSONType

Files

aeson-better-errors.cabal view
@@ -1,5 +1,5 @@ name:                aeson-better-errors-version:             0.9.0.1+version:             0.9.1.0 synopsis:            Better error messages when decoding JSON values. license:             MIT license-file:        LICENSE@@ -25,7 +25,7 @@   exposed-modules:   Data.Aeson.BetterErrors                      Data.Aeson.BetterErrors.Internal   other-modules:     Data.Aeson.BetterErrors.Utils-  build-depends:     base >=4 && <5+  build-depends:     base >=4.5 && <5                    , aeson >=0.7                    , unordered-containers                    , dlist
src/Data/Aeson/BetterErrors.hs view
@@ -18,6 +18,7 @@   , Parse'   , mapError   , (.!)+  , (<|>)    -- * Basic parsers   , asValue@@ -102,11 +103,3 @@  import Data.Aeson (Value) -- for haddock import Data.Aeson.BetterErrors.Internal---- TODO Alternative?--- use monoid, combine errors?--- Simply take rightmost?--- Or maybe take the one with the deepest path?------ Or, export our own (<|>) that uses a semigroup (since errors are--- 'nonempty') - that is, we don't want to allow failing with no error.
src/Data/Aeson/BetterErrors/Internal.hs view
@@ -78,6 +78,13 @@ (.!) :: Functor m => ParseT err m a -> (err -> err') -> ParseT err' m a (.!) = flip mapError +-- | First try the left parser, if that fails try the right.+-- | If both fail, the error will come from the right one.+(<|>) :: Monad m => ParseT err m a -> ParseT err m a -> ParseT err m a+l <|> r = catchError l (const r)++infixl 3 <|>+ -- | The type of parsers which never produce custom validation errors. type Parse' a = Parse Void a @@ -214,7 +221,7 @@   | TyNumber   | TyBool   | TyNull-  deriving (Show, Eq, Ord)+  deriving (Show, Eq, Ord, Enum, Bounded)  displayJSONType :: JSONType -> Text displayJSONType t = case t of