safecopy 0.9.2 → 0.9.3
raw patch · 2 files changed
+10/−2 lines, 2 filesdep +semigroups
Dependencies added: semigroups
Files
- safecopy.cabal +4/−2
- src/Data/SafeCopy/Instances.hs +6/−0
safecopy.cabal view
@@ -3,7 +3,7 @@ -- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr. -- The name of the package. Name: safecopy-Version: 0.9.2+Version: 0.9.3 Synopsis: Binary serialization with version control. Description: An extension to Data.Serialize with built-in version control. Homepage: https://github.com/acid-state/safecopy@@ -15,7 +15,7 @@ Build-type: Simple Extra-source-files: CHANGELOG.md Cabal-version: >=1.8-tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2, GHC==8.0.1+tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2, GHC==8.0.2 Source-repository head type: git@@ -40,6 +40,8 @@ text < 1.3, time < 1.7, vector >= 0.10 && < 0.12+ if !impl(ghc > 8.0)+ Build-Depends: semigroups >= 0.18 && < 0.19 -- Modules not exported by this package. Other-modules: Data.SafeCopy.Instances, Data.SafeCopy.SafeCopy,
src/Data/SafeCopy/Instances.hs view
@@ -20,6 +20,7 @@ import qualified Data.IntMap as IntMap import qualified Data.IntSet as IntSet import Data.Ix+import qualified Data.List.NonEmpty as NonEmpty import qualified Data.Map as Map import Data.Ratio (Ratio, (%), numerator, denominator) import qualified Data.Sequence as Sequence@@ -69,6 +70,11 @@ putCopy lst = contain $ do put (length lst) getSafePut >>= forM_ lst errorTypeName = typeName1++instance SafeCopy a => SafeCopy (NonEmpty.NonEmpty a) where+ getCopy = contain $ fmap NonEmpty.fromList safeGet+ putCopy = contain . safePut . NonEmpty.toList+ errorTypeName = typeName1 instance SafeCopy a => SafeCopy (Maybe a) where getCopy = contain $ do n <- get