packages feed

binary 0.5 → 0.5.0.1

raw patch · 2 files changed

+15/−4 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

binary.cabal view
@@ -1,5 +1,5 @@ name:            binary-version:         0.5+version:         0.5.0.1 license:         BSD3 license-file:    LICENSE author:          Lennart Kolmodin <kolmodin@dtek.chalmers.se>
src/Data/Binary.hs view
@@ -585,8 +585,19 @@ instance Binary a => Binary [a] where     put l  = put (length l) >> mapM_ put l     get    = do n <- get :: Get Int-                replicateM n get+                getMany n +-- | 'getMany n' get 'n' elements in order, without blowing the stack.+getMany :: Binary a => Int -> Get [a]+getMany n = go [] n+ where+    go xs 0 = return $! reverse xs+    go xs i = do x <- get+                 -- we must seq x to avoid stack overflows due to laziness in+                 -- (>>=)+                 x `seq` go (x:xs) (i-1)+{-# INLINE getMany #-}+ instance (Binary a) => Binary (Maybe a) where     put Nothing  = putWord8 0     put (Just x) = putWord8 1 >> put x@@ -690,7 +701,7 @@     get = do         bs <- get         n  <- get                  -- read the length-        xs <- replicateM n get     -- now the elems.+        xs <- getMany n            -- now the elems.         return (listArray bs xs)  --@@ -704,5 +715,5 @@     get = do         bs <- get         n  <- get-        xs <- replicateM n get+        xs <- getMany n         return (listArray bs xs)