packages feed

aeson-value-parser 0.19.3 → 0.19.4

raw patch · 3 files changed

+18/−17 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

aeson-value-parser.cabal view
@@ -1,5 +1,5 @@ name: aeson-value-parser-version: 0.19.3+version: 0.19.4 synopsis: API for parsing "aeson" JSON tree into Haskell types description:   A flexible parser DSL of JSON AST produced by the \"aeson\" library
library/AesonValueParser.hs view
@@ -103,7 +103,7 @@ runWithTextError parser = left Error.toText . run parser  runString :: String a -> Text -> Either (Maybe Text) a-runString (String a) b = runExcept (runReaderT a b)+runString (String a) b = first getLast (runExcept (runReaderT a b))  -- ** Definitions -------------------------@@ -141,13 +141,13 @@ {-# INLINE string #-} string :: String a -> Value a string (String parser) = Value $ ReaderT $ \ case-  Aeson.String x -> lift $ left (Error.message . fromMaybe "No details") $ runExcept $ runReaderT parser x+  Aeson.String x -> lift $ left (Error.message . fromMaybe "No details" . getLast) $ runExcept $ runReaderT parser x   _ -> empty  {-# INLINE number #-} number :: Number a -> Value a number (Number parser) = Value $ ReaderT $ \ case-  Aeson.Number x -> lift $ left (Error.message . fromMaybe "No details") $ runExcept $ runReaderT parser x+  Aeson.Number x -> lift $ left (Error.message . fromMaybe "No details" . getLast) $ runExcept $ runReaderT parser x   _ -> empty  {-# INLINE bool #-}@@ -167,7 +167,7 @@ -------------------------  newtype String a =-  String (ReaderT Text (Except (Maybe Text)) a)+  String (ReaderT Text (Except (Last Text)) a)   deriving (Functor, Applicative, Alternative)  {-# INLINE text #-}@@ -197,7 +197,7 @@  {-# INLINE matchedText #-} matchedText :: (Text -> Either Text a) -> String a-matchedText parser = String $ ReaderT $ except . left Just . parser+matchedText parser = String $ ReaderT $ except . left (Last . Just) . parser  {-# INLINE attoparsedText #-} attoparsedText :: Attoparsec.Parser a -> String a@@ -214,7 +214,7 @@ -------------------------  newtype Number a =-  Number (ReaderT Scientific (Except (Maybe Text)) a)+  Number (ReaderT Scientific (Except (Last Text)) a)   deriving (Functor, Applicative, Alternative)  {-# INLINE scientific #-}@@ -226,30 +226,30 @@ integer = Number $ ReaderT $ \ x -> if Scientific.isInteger x   then case Scientific.toBoundedInteger x of     Just int -> return int-    Nothing -> throwError (Just (fromString ("Number " <> show x <> " is out of integer range")))-  else throwError (Just (fromString ("Number " <> show x <> " is not integer")))+    Nothing -> throwError (Last (Just (fromString ("Number " <> show x <> " is out of integer range"))))+  else throwError (Last (Just (fromString ("Number " <> show x <> " is not integer"))))  {-# INLINE floating #-} floating :: RealFloat a => Number a floating = Number $ ReaderT $ \ a -> case Scientific.toBoundedRealFloat a of   Right b -> return b   Left c -> if c == 0-    then throwError (Just (fromString ("Number " <> show a <> " is too small")))-    else throwError (Just (fromString ("Number " <> show a <> " is too large")))+    then throwError (Last (Just (fromString ("Number " <> show a <> " is too small"))))+    else throwError (Last (Just (fromString ("Number " <> show a <> " is too large"))))  {-# INLINE matchedScientific #-} matchedScientific :: (Scientific -> Either Text a) -> Number a-matchedScientific matcher = Number $ ReaderT $ except . left Just . matcher+matchedScientific matcher = Number $ ReaderT $ except . left (Last . Just) . matcher  {-# INLINE matchedInteger #-} matchedInteger :: (Integral integer, Bounded integer) => (integer -> Either Text a) -> Number a matchedInteger matcher = Number $ case integer of-  Number parser -> parser >>= either (throwError . Just) return . matcher+  Number parser -> parser >>= either (throwError . Last . Just) return . matcher  {-# INLINE matchedFloating #-} matchedFloating :: RealFloat floating => (floating -> Either Text a) -> Number a matchedFloating matcher = Number $ case floating of-  Number parser -> parser >>= either (throwError . Just) return . matcher+  Number parser -> parser >>= either (throwError . Last . Just) return . matcher   -- * Object parsers
library/AesonValueParser/Prelude.hs view
@@ -9,7 +9,7 @@ -- base ------------------------- import Control.Applicative as Exports-import Control.Arrow as Exports+import Control.Arrow as Exports hiding (first, second) import Control.Category as Exports import Control.Concurrent as Exports import Control.Exception as Exports@@ -18,6 +18,7 @@ import Control.Monad.Fail as Exports import Control.Monad.Fix as Exports hiding (fix) import Control.Monad.ST as Exports+import Data.Bifunctor as Exports import Data.Bits as Exports import Data.Bool as Exports import Data.Char as Exports@@ -37,11 +38,11 @@ import Data.List as Exports hiding (sortOn, isSubsequenceOf, uncons, concat, foldr, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, find, maximumBy, minimumBy, mapAccumL, mapAccumR, foldl') import Data.List.NonEmpty as Exports (NonEmpty(..)) import Data.Maybe as Exports-import Data.Monoid as Exports hiding (Last(..), First(..), (<>))+import Data.Monoid as Exports hiding ((<>)) import Data.Ord as Exports import Data.Proxy as Exports import Data.Ratio as Exports-import Data.Semigroup as Exports+import Data.Semigroup as Exports hiding (Last(..), First(..)) import Data.STRef as Exports import Data.String as Exports import Data.Traversable as Exports