packages feed

pipes-aeson 0.2.0 → 0.2.1

raw patch · 7 files changed

+44/−24 lines, 7 filesdep ~aesondep ~attoparsecdep ~pipes-attoparsec

Dependency ranges changed: aeson, attoparsec, pipes-attoparsec

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2013, Renzo Carbonara+Copyright (c) 2013-2014, Renzo Carbonara  All rights reserved. 
− NEWS
@@ -1,11 +0,0 @@-# 0.2.0--* Version compatible with `pipes-4.0.0` and `pipes-parse-2.0.0`.--* API radically changed. Removed `parseValue`, `fromValue` and-  `TopLevelValue`. Other things renamed.---# 0.1.0.0--* First version.
PEOPLE view
@@ -3,3 +3,5 @@ discussions about the library design.  Renzo Carbonara+Michael Thompson+David Flemström
+ changelog view
@@ -0,0 +1,18 @@+# 0.2.1++* Generalize `encode` from `Producer` to `Producer'`.++* Depend on newer versions of `aeson`, `attoparsec`, `pipes-attoparsec.+++# 0.2.0++* Version compatible with `pipes-4.0.0` and `pipes-parse-2.0.0`.++* API radically changed. Removed `parseValue`, `fromValue` and+  `TopLevelValue`. Other things renamed.+++# 0.1.0.0++* First version.
pipes-aeson.cabal view
@@ -1,23 +1,23 @@ name:               pipes-aeson-version:            0.2.0+version:            0.2.1 license:            BSD3 license-file:       LICENSE-copyright:          Copyright (c) Renzo Carbonara 2013+copyright:          Copyright (c) Renzo Carbonara 2013-2014 author:             Renzo Carbonara maintainer:         renzocarbonaraλgmail.com stability:          Experimental-tested-with:        GHC ==7.4.1+tested-with:        GHC ==7.6.3 homepage:           https://github.com/k0001/pipes-aeson bug-reports:        https://github.com/k0001/pipes-aeson/issues category:           Pipes, Parser build-type:         Simple cabal-version:      >=1.8 synopsis:           Encode and decode JSON streams using Aeson and Pipes.-extra-source-files: README.md PEOPLE NEWS+extra-source-files: README.md PEOPLE changelog description:   Utilities to encode and decode Pipes streams of JSON.   .-  See the @NEWS@ file in the source distribution to learn about any+  See the @changelog@ file in the source distribution to learn about any   important changes between version.  source-repository head@@ -30,11 +30,11 @@                    Pipes.Aeson.Unsafe   other-modules:   Pipes.Aeson.Internal   build-depends:-      aeson            (>=0.6.1 && < 0.7)-    , attoparsec       (>=0.10  && <0.11)+      aeson            (>=0.6.1 && <0.8)+    , attoparsec       (>=0.10  && <0.12)     , base             (>=4.5   && <5.0)     , pipes            (>=4.0   && <4.1)-    , pipes-attoparsec (>=0.3   && <0.4)+    , pipes-attoparsec (>=0.3.1 && <0.4)     , pipes-parse      (>=2.0   && <2.1)     , bytestring       (>=0.9.2.1)     , transformers     (>=0.2   && <0.4)
src/Pipes/Aeson.hs view
@@ -34,7 +34,14 @@ -- entities, which is why this function restricts its input to them. If you -- prefer to ignore the standard and encode any 'Ae.Value', then use 'U.encode' -- from the "Pipes.Aeson.Unsafe" module.-encode :: Monad m => Either Ae.Object Ae.Array -> Producer B.ByteString m ()+--+-- /Hint:/ You can easily turn this 'Producer'' into a 'Pipe' that encodes+-- 'Ae.Array' or 'Ae.Object' values as JSON as they flow downstream using:+--+-- @+-- 'for' 'cat' 'encode' :: ('Monad' m) => 'Pipe' ('Either' 'Ae.Object' 'Ae.Array') 'B.ByteString' m r+-- @+encode :: Monad m => Either Ae.Object Ae.Array -> Producer' B.ByteString m () encode = either U.encode U.encode {-# INLINABLE encode #-} @@ -54,6 +61,9 @@  -- | Decodes an 'Ae.Object' or 'Ae.Array' JSON value from the underlying state. --+-- Returns either the decoded entitiy and the number of decoded bytes,+-- or a 'I.DecodingError' in case of failures.+-- -- /Do not/ use this function if the underlying 'Producer' has leading empty -- chunks or whitespace, otherwise you may get unexpected parsing errors. --@@ -82,8 +92,9 @@ -- -- This 'Producer' runs until it either runs out of input or until a decoding -- failure occurs, in which case it returns 'Left' with a 'I.DecodingError' and--- a 'Producer' with any leftovers. You can use 'P.errorP' to turn the 'Either'--- return value into an 'Control.Monad.Trans.Error.ErrorT' monad transformer.+-- a 'Producer' with any leftovers. You can use 'Pipes.Lift.errorP' to turn the+-- 'Either' return value into an 'Control.Monad.Trans.Error.ErrorT' monad+-- transformer. -- -- /Note:/ The JSON RFC-4627 standard only allows arrays or objects as top-level -- entities, which is why this 'Producer' restricts its output to them. If you
src/Pipes/Aeson/Unsafe.hs view
@@ -26,7 +26,7 @@  -- | Like 'Pipes.Aeson.encode', except it accepts any 'Ae.ToJSON' instance, -- not just 'Ae.Array' or 'Ae.Object'.-encode :: (Monad m, Ae.ToJSON a) => a -> Producer B.ByteString m ()+encode :: (Monad m, Ae.ToJSON a) => a -> Producer' B.ByteString m () encode = I.fromLazy . Ae.encode {-# INLINABLE encode #-}