packages feed

ptr-poker 0.1.2.3 → 0.1.2.4

raw patch · 4 files changed

+26/−2 lines, 4 filesdep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: text

API changes (from Hackage documentation)

Files

library/PtrPoker/ByteString.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ module PtrPoker.ByteString where  import Data.ByteString@@ -7,6 +9,7 @@ import qualified Data.ByteString.Builder.Scientific as ScientificBuilder import Data.ByteString.Internal import qualified Data.ByteString.Lazy as Lazy+import qualified Data.Text.Encoding as TextEncoding import qualified PtrPoker.Ffi as Ffi import PtrPoker.Prelude hiding (empty) import qualified PtrPoker.Text as Text@@ -40,9 +43,13 @@  {-# INLINEABLE textUtf8 #-} textUtf8 :: Text -> ByteString+#if MIN_VERSION_text(2,0,0)+textUtf8 t = TextEncoding.encodeUtf8 t+#else textUtf8 = Text.destruct $ \arr off len ->   if len == 0     then empty     else unsafeCreateUptoN (len * 3) $ \ptr -> do       postPtr <- inline Ffi.encodeText ptr arr (fromIntegral off) (fromIntegral len)       return (minusPtr postPtr ptr)+#endif
library/PtrPoker/Poke.hs view
@@ -1,5 +1,9 @@+{-# LANGUAGE CPP #-}+ module PtrPoker.Poke where +import qualified Data.Text.Array as TextArray+import qualified Data.Text.Internal as TextInternal import qualified PtrPoker.Ffi as Ffi import qualified PtrPoker.IO.ByteString as ByteStringIO import qualified PtrPoker.IO.Prim as PrimIO@@ -140,8 +144,15 @@ -- Encode Text in UTF8. {-# INLINE textUtf8 #-} textUtf8 :: Text -> Poke+#if MIN_VERSION_text(2,0,0)+textUtf8 (TextInternal.Text arr off len) =+  Poke (\p -> do+    stToIO $ TextArray.copyToPointer arr off p len+    pure (plusPtr p len))+#else textUtf8 = Text.destruct $ \arr off len ->   Poke (\p -> Ffi.encodeText p arr (fromIntegral off) (fromIntegral len))+#endif  -- * ASCII integers 
library/PtrPoker/Size.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+ -- | -- Functions that compute the required allocation size by value. module PtrPoker.Size where@@ -201,6 +203,9 @@ -- in UTF8. {-# INLINE textUtf8 #-} textUtf8 :: Text -> Int+#if MIN_VERSION_text(2,0,0)+textUtf8 = Text.destruct $ \_arr _off len -> len+#else textUtf8 = Text.destruct $ \arr off len ->   Ffi.countTextAllocationSize     arr@@ -208,3 +213,4 @@     (fromIntegral len)     & unsafeDupablePerformIO     & fromIntegral+#endif
ptr-poker.cabal view
@@ -1,5 +1,5 @@ name: ptr-poker-version: 0.1.2.3+version: 0.1.2.4 synopsis: Pointer poking action construction and composition toolkit homepage: https://github.com/nikita-volkov/ptr-poker bug-reports: https://github.com/nikita-volkov/ptr-poker/issues@@ -40,7 +40,7 @@     base >=4.11 && <5,     bytestring >=0.10 && <0.12,     scientific >=0.3.6.2 && <0.4,-    text >=1 && <2+    text >=1 && <3  test-suite test   type: exitcode-stdio-1.0