packages feed

aeson-utils 0.2.2.1 → 0.3

raw patch · 3 files changed

+15/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,14 @@ # Changelog +## 0.3++* The semantics of `eitherDecodeV` and `decodeV` have been changed to conform to aeson's `eitherDecode` and `decode`: They now consume until end of input and strip trailing whitespace.++  This is necessary to remove ambiguity when decoding JSON-like values that are+  not necessarily properly formatted for JSON. For example, parsing a hexadecimal+  digit sequence that starts with digits but does not have double quotes should+  fail to parse rather than be interpreted as a number.+ #### 0.2.2.1  * Allow `attoparsec 0.12.*`
aeson-utils.cabal view
@@ -1,5 +1,5 @@ name:                aeson-utils-version:             0.2.2.1+version:             0.3 synopsis:            Utilities for working with Aeson. description:         Utilities for working with Aeson. license:             BSD3@@ -27,8 +27,8 @@   exposed-modules:   Data.Aeson.Utils   build-depends:       base == 4.*-    , aeson >= 0.6 && < 0.8+    , aeson >= 0.6 && < 0.9     , attoparsec >= 0.10 && < 0.13     , bytestring >= 0.9 && < 0.11     , scientific >= 0.3.2 && < 0.4-    , text >= 0.11 && < 1.2+    , text >= 0.11 && < 1.3
src/Data/Aeson/Utils.hs view
@@ -13,12 +13,14 @@   , floatingOrInteger   ) where +import Control.Applicative ((<*)) import Data.Aeson import Data.Aeson.Parser (value) import Data.Aeson.Types import Data.Attoparsec.Lazy (Result (..)) import Data.Scientific import Data.Text (Text)+import qualified Data.Attoparsec.ByteString.Char8 as Atto (skipSpace) import qualified Data.Attoparsec.Lazy as Atto import qualified Data.ByteString.Lazy as L @@ -26,7 +28,7 @@  -- | Like 'decodeV', but returns an error message when decoding fails. eitherDecodeV :: FromJSON a => L.ByteString -> Either String a-eitherDecodeV v = case Atto.parse value v of+eitherDecodeV v = case Atto.parse (value <* Atto.skipSpace <* Atto.endOfInput) v of   Fail _ _ err -> Left err   Done _ r     -> case fromJSON r of     Error e   -> Left e