serokell-util 0.1.4.0 → 0.1.5.0
raw patch · 2 files changed
+7/−8 lines, 2 filesnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Serokell.AcidState.Instances: instance Data.SafeCopy.SafeCopy.SafeCopy a => Data.SafeCopy.SafeCopy.SafeCopy (Data.List.NonEmpty.NonEmpty a)
Files
serokell-util.cabal view
@@ -1,5 +1,5 @@ name: serokell-util-version: 0.1.4.0+version: 0.1.5.0 synopsis: General-purpose functions by Serokell homepage: https://github.com/serokell/serokell-util license: MIT
src/Serokell/AcidState/Instances.hs view
@@ -15,10 +15,13 @@ import qualified Data.HashMap.Strict as HM hiding (HashMap) import Data.HashSet (HashSet) import qualified Data.HashSet as HS hiding (HashSet)-import qualified Data.List.NonEmpty as NE import Data.SafeCopy (SafeCopy (..), contain, safeGet, safePut) +#if !MIN_VERSION_safecopy(0,9,3)+import qualified Data.List.NonEmpty as NE+#endif+ -- | Usually Queries shouldn't throw anything. This is a dirty hack. instance MonadThrow (Query s) where throwM = throw@@ -34,12 +37,7 @@ putCopy = contain . safePut . HM.toList getCopy = contain $ HM.fromList <$> safeGet --- [SRK-51]: we should try to get this one into safecopy itself though it's--- unlikely that they will choose a different implementation (if they do--- choose a different implementation we'll have to write a migration)------ update: made a PR <https://github.com/acid-state/safecopy/pull/47>;--- remove this instance when the pull request is merged+#if !MIN_VERSION_safecopy(0,9,3) instance SafeCopy a => SafeCopy (NE.NonEmpty a) where getCopy = contain $ do xs <- safeGet@@ -48,6 +46,7 @@ Just xx -> return xx putCopy = contain . safePut . NE.toList errorTypeName _ = "NonEmpty"+#endif #define SAFECOPY_TIME(T, TS) \ instance SafeCopy T where { \