packages feed

safecopy-store 0.9.3 → 0.9.4

raw patch · 5 files changed

+43/−7 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,9 @@+0.9.4+=====++ - compatible with lts-8.13+ - fix TH deriving for sums+  0.9.3 ===== @@ -24,5 +30,3 @@ [https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced](https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced)  [https://github.com/GaloisInc/cereal/issues/35](https://github.com/GaloisInc/cereal/issues/35)--
safecopy-store.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-store-Version:             0.9.3+Version:             0.9.4 Synopsis:            Binary serialization with version control. Description:         Fork of safecopy that uses store instead of cereal. Homepage:            https://github.com/NCrashed/safecopy@@ -29,7 +29,7 @@   Hs-Source-Dirs:      src/    -- Packages needed in order to build this package.-  Build-depends:       base >=4.5 && <5,+  Build-depends:       base >=4.8 && <5,                        array < 0.6,                        bytestring < 0.11,                        containers >= 0.3 && < 0.6,@@ -59,6 +59,7 @@ Test-suite instances   Type:                exitcode-stdio-1.0   Main-is:             instances.hs+  Other-modules:       Deriving   Hs-Source-Dirs:      test/   GHC-Options:         -Wall -threaded -rtsopts -with-rtsopts=-N   Build-depends:       base, store, template-haskell, safecopy-store,
src/Data/SafeCopy/Store/Derive.hs view
@@ -358,7 +358,7 @@                asName <- newName "a"                let putClause   = asP asName $ conP (conName con) (map varP putVars)                    putCopyBody = varE 'contain `appE` doE (-                                   [ bindS wildP $ varE 'pokeE `appE` litE (IntegerL conNumber) | manyConstructors ] +++                                   [ bindS wildP $ varE 'pokeE `appE` sigE (litE (IntegerL conNumber)) (conT ''Integer) | manyConstructors ] ++                                    putFunsDecs ++                                    [ bindS wildP $ varE (putFuns typ) `appE` varE var | (typ, var) <- zip (conTypes con) putVars ] ++                                    [ noBindS $ varE 'return `appE` varE asName ])@@ -373,8 +373,8 @@               [(_, con)] | not (forceTag deriveType) -> mkGetBody con               _ -> do                 tagVar <- newName "tag"-                doE [ bindS (varP tagVar) (varE 'poke)-                    , noBindS $ caseE (varE tagVar) (+                doE [ bindS (varP tagVar) (varE 'peek)+                    , noBindS $ caseE (sigE (varE tagVar) (conT ''Integer)) (                         [ match (litP $ IntegerL i) (normalB $ mkGetBody con) [] | (i, con) <- cons ] ++                         [ match wildP (normalB $ varE 'fail `appE` errorMsg tagVar) [] ]) ]       mkGetBody con
+ test/Deriving.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE TemplateHaskell #-}+-- | Test for TH deriving+module Deriving where++import Data.SafeCopy.Store+import Test.QuickCheck.Arbitrary+import Test.QuickCheck.Gen++data A = A1 | A2 | A3+  deriving (Bounded, Enum, Show, Eq)++instance Arbitrary A where+  arbitrary = arbitraryBoundedEnum++deriveSafeCopy 1 'base ''A++data B = B1 | B2 Bool | B3 A A+  deriving (Show, Eq)++instance Arbitrary B where+  arbitrary = do+    n <- choose (0, 2 :: Int)+    case n of+      0 -> pure B1+      1 -> B2 <$> arbitrary+      2 -> B3 <$> arbitrary <*> arbitrary+      _ -> pure B1++deriveSafeCopy 1 'base ''B
test/instances.hs view
@@ -10,6 +10,8 @@ #define MIN_VERSION_template_haskell(x,y,z) 1 #endif +import Deriving+ import Control.Lens import Control.Lens.Action import Data.Array (Array)