packages feed

safecopy 0.8.6 → 0.9.0

raw patch · 3 files changed

+65/−6 lines, 3 filesdep ~arraydep ~basedep ~bytestringnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: array, base, bytestring, cereal, containers, old-time, text, time, vector

API changes (from Hackage documentation)

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.6+Version:             0.9.0  -- A short (one-line) description of the package. Synopsis:            Binary serialization with version control.@@ -54,8 +54,16 @@   Hs-Source-Dirs:      src/    -- Packages needed in order to build this package.-  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+  Build-depends:       base >=4.5 && <5,+                       array < 0.6,+                       cereal >= 0.5 && < 0.6,+                       bytestring < 0.11,+                       containers >= 0.3 && < 0.6,+                       old-time < 1.2,+                       template-haskell < 2.11,+                       text < 1.3,+                       time < 1.6,+                       vector >= 0.10 && < 0.12    -- Modules not exported by this package.   Other-modules:       Data.SafeCopy.Instances, Data.SafeCopy.SafeCopy,
src/Data/SafeCopy/Instances.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts, UndecidableInstances #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, UndecidableInstances, TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Data.SafeCopy.Instances where @@ -163,10 +163,50 @@     getCopy = contain get; putCopy = contain . put; errorTypeName = typeName instance SafeCopy Integer where     getCopy = contain get; putCopy = contain . put; errorTypeName = typeName++-- | cereal change the formats for Float/Double in 0.5.*+--+-- https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced+-- https://github.com/GaloisInc/cereal/issues/35+newtype CerealFloat040 = CerealFloat040 { unCerealFloat040 :: Float} deriving (Show, Typeable)+instance SafeCopy CerealFloat040 where+    getCopy = contain (CerealFloat040 <$> liftM2 encodeFloat get get)+    putCopy (CerealFloat040 float) = contain (put (decodeFloat float))+    errorTypeName = typeName++instance Migrate Float where+  type MigrateFrom Float = CerealFloat040+  migrate (CerealFloat040 d) = d+ instance SafeCopy Float where-    getCopy = contain get; putCopy = contain . put; errorTypeName = typeName+  version = Version 1+  kind = extension+  getCopy = contain get+  putCopy = contain . put+  errorTypeName = typeName++-- | cereal change the formats for Float/Double in 0.5.*+--+-- https://github.com/GaloisInc/cereal/commit/47d839609413e3e9d1147b99c34ae421ae36bced+-- https://github.com/GaloisInc/cereal/issues/35+newtype CerealDouble040 = CerealDouble040 { unCerealDouble040 :: Double} deriving (Show, Typeable)+instance SafeCopy CerealDouble040 where+    getCopy = contain (CerealDouble040 <$> liftM2 encodeFloat get get)+    putCopy (CerealDouble040 double) = contain (put (decodeFloat double))+    errorTypeName = typeName++instance Migrate Double where+  type MigrateFrom Double = CerealDouble040+  migrate (CerealDouble040 d) = d+ instance SafeCopy Double where-    getCopy = contain get; putCopy = contain . put; errorTypeName = typeName+  version = Version 1+  kind = extension+  getCopy = contain get+  putCopy = contain . put+  errorTypeName = typeName++ instance SafeCopy L.ByteString where     getCopy = contain get; putCopy = contain . put; errorTypeName = typeName instance SafeCopy B.ByteString where
test/instances.hs view
@@ -99,7 +99,18 @@     safecopy <- reify ''SafeCopy    preds <- 'prop_inverse ^!! act reify . (template :: Traversal' Info Pred)+#if !MIN_VERSION_template_haskell(2,10,0)    classes <- mapM reify [ name | ClassP name _ <- preds ]+#else+--   print preds++   classes <-+         case preds of+           [ForallT _ cxt' _] ->+              mapM reify [ name | AppT (ConT name) _ <- cxt' ]+           _ -> error "FIXME: fix this code to handle this case."+--   classes <- mapM reify [ ]+#endif    def <- a     let instances (ClassI _ decs) = [ typ | InstanceD _ (AppT _ typ) _ <- decs ]