packages feed

pinch 0.3.4.1 → 0.3.5.0

raw patch · 3 files changed

+19/−1 lines, 3 filesdep ~hashablePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hashable

API changes (from Hackage documentation)

+ Pinch: decodeWithLeftovers :: Pinchable a => Protocol -> ByteString -> Either String (ByteString, a)

Files

CHANGES.md view
@@ -1,3 +1,9 @@+0.3.5.0 (2019-09-25)+====================++-   Introduce decodeWithLeftovers for receiving unparsed portions+    of the provided bytestring.+ 0.3.4.1 (2019-02-20) ==================== 
pinch.cabal view
@@ -5,7 +5,7 @@ -- hash: a26aa0d54b7b1bd93ac84d5f821dcc0245b6df6ff10cb67dda63ee3f7f879551  name:           pinch-version:        0.3.4.1+version:        0.3.5.0 cabal-version:  >= 1.10 build-type:     Simple license:        BSD3
src/Pinch.hs view
@@ -19,6 +19,7 @@        encode     , decode+    , decodeWithLeftovers      -- * RPC @@ -207,6 +208,17 @@ decode :: Pinchable a => Protocol -> ByteString -> Either String a decode p = deserializeValue p >=> runParser . unpinch {-# INLINE decode #-}++-- | Decode a 'Pinchable' value from the using the given 'Protocol'+-- and also return the "unparsed" portion of the bytestring.+--+-- >>> let s = pack [3,0,0,0,5,1,2,3,4,5,0,0,0]+-- >>> decodeWithLeftovers binaryProtocol s :: Either String (ByteString, [Int8])+-- Right ("\NUL\NUL\NUL",[1,2,3,4,5])+--+decodeWithLeftovers :: Pinchable a => Protocol -> ByteString -> Either String (ByteString, a)+decodeWithLeftovers p = deserializeValue' p >=> traverse (runParser . unpinch)+{-# INLINE decodeWithLeftovers #-}  ------------------------------------------------------------------------------