packages feed

RefSerialize 0.3.1.1 → 0.3.1.2

raw patch · 3 files changed

+28/−19 lines, 3 filesdep +stringsearch

Dependencies added: stringsearch

Files

Data/RefSerialize.hs view
@@ -117,8 +117,8 @@ import Data.Monoid import Data.Maybe -import Debug.Trace-(!>) = flip . trace+--import Debug.Trace+--(!>) = flip  trace  newContext :: IO Context newContext  = Data.RefSerialize.Serialize.empty@@ -211,7 +211,7 @@    in if Prelude.null l then Left . Error $  "not readable: " ++ us          else let ((x,str2):_)= l               in Right(StatR(c, pack $ Prelude.dropWhile isSpace str2,v),x) )-   <?> "readp: readsPrec "+   <?> "readpText: readsPrec "   @@ -599,17 +599,21 @@ readpBinary = do       symbol binPrefix       n     <- integer-      str   <- takep $ fromIntegral n+      str   <- takep (fromIntegral n)       let x = decode str       return x  -- return n chars form the serialized data-takep :: Int -> STR ByteString-takep n=   take1 "" n-  where-  take1 s 0= return  s-  take1 s n=  anyChar >>= \x -> take1 (snoc s x ) (n-1)+--takep :: Int -> STR ByteString+--takep n=   take1 "" n+--  where+--  take1 s 0= return  s+--  take1 s n=  anyChar >>= \x -> take1 (snoc s x ) (n-1) +takep n=STR(\(StatR(c,s,v)) ->+   let (x,r)= B.splitAt n s+   in Right(StatR(c, r,v),x) )+   <?> "takep "  -- | default instances 
Data/RefSerialize/Serialize.hs view
@@ -15,9 +15,10 @@ import System.IO.Unsafe import Control.Monad (MonadPlus(..)) import Data.ByteString.Lazy.Char8 as B---import qualified Data.HashTable  as HT+import Data.ByteString.Lazy.Search import qualified Data.HashTable.IO as HT import Data.Ord+import Data.Monoid   type MFun=  Char -- usafeCoherced to char to store simply the address of the function@@ -80,13 +81,17 @@   (hash,st) = hasht x  readContext :: ByteString -> ByteString -> (ByteString, ByteString)-readContext pattern str= readContext1  (pack "") str where+readContext pattern str=+  let (s1,s2)= breakOn (toStrict pattern) str+  in  (s1, B.drop (fromIntegral $ B.length pattern) s2) - readContext1 :: ByteString -> ByteString -> (ByteString, ByteString)- readContext1 s str| B.null str = (s, pack "")-                   | pattern `B.isPrefixOf` str = (s, B.drop n str)-                   | otherwise=   readContext1 (snoc s (B.head str)) (B.tail str)-                    where n= fromIntegral $ B.length pattern+--readContext pattern str= readContext1  mempty str where+--+-- readContext1 :: ByteString -> ByteString -> (ByteString, ByteString)+-- readContext1 s str| B.null str = (s, pack "")+--                   | pattern `B.isPrefixOf` str = (s, B.drop n str)+--                   | otherwise=   readContext1 (snoc s (B.head str)) (B.tail str)+--                    where n= fromIntegral $ B.length pattern   hasht x= unsafePerformIO $ do
RefSerialize.cabal view
@@ -1,5 +1,5 @@ name:                RefSerialize-version:             0.3.1.1+version:             0.3.1.2 synopsis:            Write to and read from ByteStrings maintaining internal memory references description:                      Read, Show and Binary instances do not check for internal data references to the same address.@@ -9,7 +9,7 @@                      data is very typical in a pure language such is Haskell, this means that the resulting data loose the beatiful                      economy of space and processing time that referential transparency permits.                      .-                     In this release the default "(Read a, Show a) => Refserialize a" has been removed.+                     In this release deserialization is much, much faster by using the stringsearch package                      .                      See "Data.RefSerialize" for details @@ -22,7 +22,7 @@ maintainer:           agocorona@gmail.com Tested-With:        GHC == 6.8.2 Build-Type:          Simple-build-Depends:      binary,bytestring, base >=4 && <5,containers, hashtables+build-Depends:      binary,bytestring, base >=4 && <5,containers, hashtables,stringsearch   exposed-modules:     Data.RefSerialize, Data.RefSerialize.Parser, Data.RefSerialize.Serialize