packages feed

proto-lens 0.7.1.2 → 0.7.1.3

raw patch · 3 files changed

+18/−7 lines, 3 filesdep ~basedep ~ghc-primdep ~primitivePVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: base, ghc-prim, primitive, transformers

API changes (from Hackage documentation)

+ Data.ProtoLens.Encoding.Bytes: getText :: Int -> Parser Text
+ Data.ProtoLens.Encoding.Parser: getText :: Int -> Parser Text

Files

proto-lens.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack  name:           proto-lens-version:        0.7.1.2+version:        0.7.1.3 synopsis:       A lens-based implementation of protocol buffers in Haskell. description:    The proto-lens library provides an API for protocol buffers using modern Haskell language and library patterns.  Specifically, it provides:                 .@@ -58,19 +58,19 @@   hs-source-dirs:       src   build-depends:-      base >=4.10 && <4.18+      base >=4.10 && <4.19     , bytestring >=0.10 && <0.12     , containers >=0.5 && <0.7     , deepseq ==1.4.*-    , ghc-prim >=0.4 && <0.10+    , ghc-prim >=0.4 && <0.11     , lens-family >=1.2 && <2.2     , parsec ==3.1.*     , pretty ==1.1.*-    , primitive >=0.6 && <0.8+    , primitive >=0.6 && <0.9     , profunctors >=5.2 && <6.0     , tagged ==0.8.*     , text >=1.2 && <2.1-    , transformers >=0.4 && <0.6+    , transformers >=0.4 && <0.7     , vector >=0.11 && <0.14   default-language: Haskell2010 
src/Data/ProtoLens/Encoding/Bytes.hs view
@@ -22,6 +22,8 @@     -- * Bytestrings     getBytes,     putBytes,+    -- * Text+    getText,     -- * Integral types     getVarInt,     getVarIntH,
src/Data/ProtoLens/Encoding/Parser.hs view
@@ -11,6 +11,7 @@     , getWord8     , getWord32le     , getBytes+    , getText     , (<?>)     ) where @@ -18,6 +19,8 @@ import Data.Word (Word8, Word32) import Data.ByteString (ByteString, packCStringLen) import qualified Data.ByteString.Unsafe as B+import Data.Text (Text)+import Data.Text.Encoding (decodeUtf8') import Foreign.Ptr import Foreign.Storable import System.IO.Unsafe (unsafePerformIO)@@ -68,6 +71,12 @@ getBytes n = withSized n "getBytes: Unexpected end of input"                     $ \pos -> packCStringLen (castPtr pos, n) +getText :: Int -> Parser Text+getText n = do+  r <- withSized n "getText: Unexpected end of input" $ \pos ->+          decodeUtf8' <$> B.unsafePackCStringLen (castPtr pos, n)+  either (fail . show) pure r+ -- | Helper function for reading bytes from the current position and -- advancing the pointer. --@@ -86,7 +95,7 @@     | otherwise = fail "withSized: negative length" {-# INLINE withSized #-} --- | Run the given parsing action as if there are only +-- | Run the given parsing action as if there are only -- @len@ bytes remaining.  That is, once @len@ bytes have been -- consumed, 'atEnd' will return 'True' and other actions -- like 'getWord8' will act like there is no input remaining.