packages feed

safecopy 0.8.5 → 0.8.6

raw patch · 3 files changed

+19/−12 lines, 3 filesdep ~vector

Dependency ranges changed: vector

Files

safecopy.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version:             0.8.5+Version:             0.8.6  -- A short (one-line) description of the package. Synopsis:            Binary serialization with version control.@@ -54,8 +54,8 @@   Hs-Source-Dirs:      src/    -- Packages needed in order to build this package.-  Build-depends:       base >=4 && <5, array, cereal >= 0.3.1.0, bytestring, containers >= 0.3,-                       old-time, template-haskell, text, time, vector == 0.10.*+  Build-depends:       base >=4.5 && <5, array, cereal >= 0.3.1.0, bytestring, containers >= 0.3,+                       old-time, template-haskell, text, time, vector >= 0.10    -- Modules not exported by this package.   Other-modules:       Data.SafeCopy.Instances, Data.SafeCopy.SafeCopy,
src/Data/SafeCopy/Derive.hs view
@@ -23,7 +23,9 @@ #else import Language.Haskell.TH hiding (Kind(..)) #endif+#if !MIN_VERSION_base(4,8,0) import Control.Applicative+#endif import Control.Monad import Data.Maybe (fromMaybe) #ifdef __HADDOCK__
src/Data/SafeCopy/Instances.hs view
@@ -5,7 +5,9 @@  import Data.SafeCopy.SafeCopy +#if !MIN_VERSION_base(4,8,0) import           Control.Applicative+#endif import           Control.Monad import qualified Data.Array as Array import qualified Data.Array.Unboxed as UArray@@ -55,15 +57,18 @@     = contain $ unsafeUnPack (putCopy e)  instance SafeCopy a => SafeCopy [a] where-    getCopy = contain $-              do n <- get-                 getSafeGet >>= replicateM n-    putCopy lst-        = contain $-          do put (length lst)-             getSafePut >>= forM_ lst--    errorTypeName = typeName1+  getCopy = contain $ do+    n <- get+    g <- getSafeGet+    go g [] n+      where+        go :: Get a -> [a] -> Int -> Get [a]+        go _ as 0 = return (reverse as)+        go g as i = do x <- g+                       x `seq` go g (x:as) (i - 1)+  putCopy lst = contain $ do put (length lst)+                             getSafePut >>= forM_ lst+  errorTypeName = typeName1  instance SafeCopy a => SafeCopy (Maybe a) where     getCopy = contain $ do n <- get