memory 0.13 → 0.14
raw patch · 3 files changed
+16/−3 lines, 3 filesdep +foundationdep ~basedep ~deepseq
Dependencies added: foundation
Dependency ranges changed: base, deepseq
Files
- Data/ByteArray/Parse.hs +1/−1
- Data/ByteArray/ScrubbedBytes.hs +12/−0
- memory.cabal +3/−2
Data/ByteArray/Parse.hs view
@@ -174,7 +174,7 @@ case B.uncons buf of Nothing -> runParser (getMore >> byte w) buf err ok Just (c1,b2) | c1 == w -> ok b2 ()- | otherwise -> err buf ("byte " ++ show w ++ " : failed")+ | otherwise -> err buf ("byte " ++ show w ++ " : failed : got " ++ show c1) -- | Parse a sequence of bytes from current position --
Data/ByteArray/ScrubbedBytes.hs view
@@ -17,12 +17,14 @@ import GHC.Prim import GHC.Ptr import Data.Monoid+import Data.String (IsString(..)) import Data.Memory.PtrMethods (memCopy, memConstEqual) import Data.Memory.Internal.CompatPrim import Data.Memory.Internal.Compat (unsafeDoIO) import Data.Memory.Internal.Imports import Data.Memory.Internal.Scrubber (getScrubber) import Data.ByteArray.Types+import Foreign.Storable -- | ScrubbedBytes is a memory chunk which have the properties of: --@@ -47,6 +49,8 @@ mconcat = unsafeDoIO . scrubbedBytesConcat instance NFData ScrubbedBytes where rnf b = b `seq` ()+instance IsString ScrubbedBytes where+ fromString = scrubbedFromChar8 instance ByteArrayAccess ScrubbedBytes where length = sizeofScrubbedBytes@@ -163,3 +167,11 @@ then loop (i +# 1#) s3 else if booleanPrim (ltWord# e1 e2) then (# s3, LT #) else (# s3, GT #)++scrubbedFromChar8 :: [Char] -> ScrubbedBytes+scrubbedFromChar8 l = unsafeDoIO $ scrubbedBytesAlloc len (fill l)+ where+ len = Prelude.length l+ fill :: [Char] -> Ptr Word8 -> IO ()+ fill [] _ = return ()+ fill (x:xs) !p = poke p (fromIntegral $ fromEnum x) >> fill xs (p `plusPtr` 1)
memory.cabal view
@@ -1,5 +1,5 @@ Name: memory-Version: 0.13+Version: 0.14 Synopsis: memory and related abstraction stuff Description: Chunk of memory, polymorphic byte array management and manipulation@@ -71,6 +71,7 @@ Data.ByteArray.MemView Data.ByteArray.View Build-depends: base >= 4 && < 5+ , foundation , ghc-prim -- FIXME armel or mispel is also little endian. -- might be a good idea to also add a runtime autodetect mode.@@ -88,7 +89,7 @@ Build-depends: bytestring if flag(support_deepseq) CPP-options: -DWITH_DEEPSEQ_SUPPORT- Build-depends: deepseq+ Build-depends: deepseq >= 1.1 ghc-options: -Wall -fwarn-tabs default-language: Haskell2010