safecopy 0.10.3 → 0.10.3.1
raw patch · 5 files changed
+21/−12 lines, 5 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- safecopy.cabal +6/−3
- src/Data/SafeCopy/Derive.hs +6/−0
- src/Data/SafeCopy/Instances.hs +2/−2
- src/Data/SafeCopy/SafeCopy.hs +6/−6
- test/generic.hs +1/−1
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.10.3+Version: 0.10.3.1 Synopsis: Binary serialization with version control. Description: An extension to Data.Serialize with built-in version control. Homepage: https://github.com/acid-state/safecopy@@ -14,7 +14,7 @@ Category: Data, Parsing Build-type: Simple Extra-source-files: CHANGELOG.md-Cabal-version: >=1.8+Cabal-version: >=1.10 tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.3, GHC==8.10.1 Source-repository head@@ -23,6 +23,7 @@ Library+ Default-language: Haskell2010 -- Modules exported by the library. Exposed-modules: Data.SafeCopy Data.SafeCopy.Internal@@ -37,7 +38,7 @@ generic-data >= 0.3, containers >= 0.3 && < 0.7, old-time < 1.2,- template-haskell < 2.17,+ template-haskell < 2.18, text < 1.3, time < 1.10, transformers < 0.6,@@ -55,6 +56,7 @@ cpp-options: -DDEFAULT_SIGNATURES -DSAFE_HASKELL Test-suite instances+ Default-language: Haskell2010 Type: exitcode-stdio-1.0 Main-is: instances.hs Hs-Source-Dirs: test/@@ -64,6 +66,7 @@ lens-action, tasty, tasty-quickcheck, quickcheck-instances, QuickCheck Test-suite generic+ Default-language: Haskell2010 Type: exitcode-stdio-1.0 Main-is: generic.hs Hs-Source-Dirs: test/
src/Data/SafeCopy/Derive.hs view
@@ -219,9 +219,15 @@ forceTag HappstackData = True forceTag _ = False +#if MIN_VERSION_template_haskell(2,17,0)+tyVarName :: TyVarBndr s -> Name+tyVarName (PlainTV n _) = n+tyVarName (KindedTV n _ _) = n+#else tyVarName :: TyVarBndr -> Name tyVarName (PlainTV n) = n tyVarName (KindedTV n _) = n+#endif internalDeriveSafeCopy :: DeriveType -> Version a -> Name -> Name -> Q [Dec] internalDeriveSafeCopy deriveType versionId kindName tyName = do
src/Data/SafeCopy/Instances.hs view
@@ -169,7 +169,7 @@ instance SafeCopy Natural where getCopy = contain get; putCopy = contain . put; errorTypeName = typeName --- | cereal change the formats for Float/Double in 0.5.*+-- | cereal changed the formats for Float/Double in 0.5.* -- -- https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced -- https://github.com/GaloisInc/cereal/issues/35@@ -190,7 +190,7 @@ putCopy = contain . put errorTypeName = typeName --- | cereal change the formats for Float/Double in 0.5.*+-- | cereal changed the formats for Float/Double in 0.5.* -- -- https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced -- https://github.com/GaloisInc/cereal/issues/35
src/Data/SafeCopy/SafeCopy.hs view
@@ -67,11 +67,11 @@ -- Primitives kinds (see 'primitive') are not tagged with a version -- id and hence cannot be extended later. ----- Extensions (see 'extension') tells the system that there exists+-- Extensions (see 'extension') tell the system that there exists -- a previous version of the data type which should be migrated if -- needed. ----- There is also a default kind which is neither primitive nor is+-- There is also a default kind which is neither primitive nor -- an extension of a previous type. data Kind a where Primitive :: Kind a@@ -117,7 +117,7 @@ -- | This method defines how a value should be parsed without worrying about -- previous versions or migrations. This function cannot be used directly.- -- One should use 'safeGet', instead.+ -- One should use 'safePut, instead. putCopy :: a -> Contained Put -- | Internal function that should not be overrided.@@ -287,7 +287,7 @@ -- | Whereas the other 'getSafeGet' is only run when we know we need a -- version, this one is run for every field and must decide whether to -- read a version or not. It constructs a Map TypeRep Int32 and reads--- whent he new TypeRep is not in the map.+-- when the new TypeRep is not in the map. getSafeGetGeneric :: forall a. SafeCopy' a => StateT (Map TypeRep Int32) Get (Get a)@@ -474,7 +474,7 @@ -- parsers/putters. -- | To ensure that no-one reads or writes values without handling versions--- correct, it is necessary to restrict access to 'getCopy' and 'putCopy'.+-- correctly, it is necessary to restrict access to 'getCopy' and 'putCopy'. -- This is where 'Contained' enters the picture. It allows you to put -- values in to a container but not to take them out again. newtype Contained a = Contained {unsafeUnPack :: a}@@ -547,7 +547,7 @@ Consistent -> ks -- | PutM doesn't have reasonable 'fail' implementation.--- It just throws unpure exception anyway.+-- It just throws an unpure exception anyway. unpureCheckConsistency :: SafeCopy a => Proxy a -> b -> b unpureCheckConsistency proxy ks = case consistentFromProxy proxy of
test/generic.hs view
@@ -217,9 +217,9 @@ t3 = (T3 'c') t4 = T4 100 200 300 -$(deriveSafeCopy 3 'base ''T1) $(deriveSafeCopy 4 'base ''T2) $(deriveSafeCopy 5 'base ''T3)+$(deriveSafeCopy 3 'base ''T1) $(deriveSafeCopy 6 'base ''T4) data T1G = T1G Char T2G T3G deriving (Generic, Show)