store 0.5.0.1 → 0.5.1.0
raw patch · 4 files changed
+48/−33 lines, 4 filesdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: template-haskell
API changes (from Hackage documentation)
- Data.Store.Internal: instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a, Data.Store.Impl.Store a) => Data.Store.Impl.Store (Data.HashSet.HashSet a)
- Data.Store.Internal: instance Data.Store.Impl.Store a => Data.Store.Impl.Store (GHC.Base.Maybe a)
- System.IO.ByteBuffer: instance GHC.Exception.Exception System.IO.ByteBuffer.ByteBufferException
+ Data.Store.Internal: instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a, Data.Store.Impl.Store a) => Data.Store.Impl.Store (Data.HashSet.Base.HashSet a)
+ Data.Store.Internal: instance Data.Store.Impl.Store a => Data.Store.Impl.Store (GHC.Maybe.Maybe a)
+ System.IO.ByteBuffer: instance GHC.Exception.Type.Exception System.IO.ByteBuffer.ByteBufferException
- Data.Store.Internal: runPeek :: Peek a -> PeekState -> Ptr Word8 -> IO PeekResult a
+ Data.Store.Internal: runPeek :: Peek a -> PeekState -> Ptr Word8 -> IO (PeekResult a)
Files
- ChangeLog.md +6/−0
- src/Data/Store/Internal.hs +1/−1
- src/Data/Store/TH/Internal.hs +14/−5
- store.cabal +27/−27
ChangeLog.md view
@@ -1,5 +1,11 @@ # ChangeLog +## 0.5.1.0++* Update to TH to support sum types with more than 62 constructors.++* Uses TH to derive Either instance, so that it can sometimes have ConstSize #119.+ ## 0.5.0.1 * Updates to test-suite enabling `store` to build with newer dependencies.
src/Data/Store/Internal.hs view
@@ -688,7 +688,6 @@ instance Store a => Store (First a) instance Store a => Store (Last a) instance Store a => Store (Maybe a)-instance (Store a, Store b) => Store (Either a b) -- FIXME: have TH deriving handle unboxed fields? @@ -702,6 +701,7 @@ instance Deriving (Store Any) instance Deriving (Store Void) instance Deriving (Store Bool)+ instance (Store a, Store b) => Deriving (Store (Either a b)) |])) -- TODO: higher arities? Limited now by Generics instances for tuples
src/Data/Store/TH/Internal.hs view
@@ -103,9 +103,16 @@ sizeNames = zipWith (\_ -> mkName . ("sz" ++) . show) cons ints tagName = mkName "tag" valName = mkName "val"- sizeExpr =- caseE (tupE (concatMap (map sizeAtType . snd) cons))- (if null sizeNames then [matchConstSize] else [matchConstSize, matchVarSize])+ sizeExpr+ -- Maximum size of GHC tuples+ | length cons <= 62 =+ caseE (tupE (concatMap (map sizeAtType . snd) cons))+ (case cons of+ -- Avoid overlapping matches when the case expression is ()+ [] -> [matchConstSize]+ [c] | null (snd c) -> [matchConstSize]+ _ -> [matchConstSize, matchVarSize])+ | otherwise = varSizeExpr where sizeAtType :: (Name, Type) -> ExpQ sizeAtType (_, ty) = [| size :: Size $(return ty) |]@@ -139,9 +146,11 @@ matchVarSize :: MatchQ matchVarSize = do match (tupP (map (\(n, _) -> varP n) (concatMap snd cons)))- (normalB [| VarSize $ \x -> tagSize +- $(caseE [| x |] (map matchVar cons)) |])+ (normalB varSizeExpr) []+ varSizeExpr :: ExpQ+ varSizeExpr =+ [| VarSize $ \x -> tagSize + $(caseE [| x |] (map matchVar cons)) |] matchVar :: (Name, [(Name, Type)]) -> MatchQ matchVar (cname, []) = match (conP cname []) (normalB [| 0 |]) []
store.cabal view
@@ -1,13 +1,13 @@-cabal-version: >= 1.10+cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.29.0.+-- This file has been generated from package.yaml by hpack version 0.31.1. -- -- see: https://github.com/sol/hpack ----- hash: cf65d77ec7461cd466e325a485e2ac48b5cbfcf303c243e11f5b8e9674d9057e+-- hash: 5c038df3338fc7661664ddc082dde9288b48c1153a7680a63b2aed528590535e name: store-version: 0.5.0.1+version: 0.5.1.0 synopsis: Fast binary serialization category: Serialization, Data homepage: https://github.com/fpco/store#readme@@ -151,12 +151,14 @@ , void >=0.5.11 default-language: Haskell2010 -test-suite store-weigh+benchmark store-bench type: exitcode-stdio-1.0- main-is: Allocations.hs+ main-is: Bench.hs+ other-modules:+ Paths_store hs-source-dirs:- test- ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -O2 -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T -O2+ bench+ ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -O2 -threaded -rtsopts -with-rtsopts=-N1 -with-rtsopts=-s -with-rtsopts=-qg build-depends: array >=0.5.0.0 , async >=2.0.2@@ -165,8 +167,6 @@ , base64-bytestring >=0.1.1 , bifunctors >=4.0 , bytestring >=0.10.4.0- , cereal- , cereal-vector , containers >=0.5.5.1 , contravariant >=1.3 , criterion@@ -203,19 +203,24 @@ , transformers >=0.3.0.0 , unordered-containers >=0.2.5.1 , vector >=0.10.12.3- , vector-binary-instances , void >=0.5.11- , weigh+ if flag(comparison-bench)+ cpp-options: -DCOMPARISON_BENCH+ build-depends:+ binary+ , cereal+ , cereal-vector+ , vector-binary-instances+ if flag(small-bench)+ cpp-options: -DSMALL_BENCH default-language: Haskell2010 -benchmark store-bench+benchmark store-weigh type: exitcode-stdio-1.0- main-is: Bench.hs- other-modules:- Paths_store+ main-is: Allocations.hs hs-source-dirs:- bench- ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -O2 -threaded -rtsopts -with-rtsopts=-N1 -with-rtsopts=-s -with-rtsopts=-qg+ test+ ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -O2 -threaded -rtsopts -with-rtsopts=-N -with-rtsopts=-T -O2 build-depends: array >=0.5.0.0 , async >=2.0.2@@ -224,6 +229,8 @@ , base64-bytestring >=0.1.1 , bifunctors >=4.0 , bytestring >=0.10.4.0+ , cereal+ , cereal-vector , containers >=0.5.5.1 , contravariant >=1.3 , criterion@@ -260,14 +267,7 @@ , transformers >=0.3.0.0 , unordered-containers >=0.2.5.1 , vector >=0.10.12.3+ , vector-binary-instances , void >=0.5.11- if flag(comparison-bench)- cpp-options: -DCOMPARISON_BENCH- build-depends:- binary- , cereal- , cereal-vector- , vector-binary-instances- if flag(small-bench)- cpp-options: -DSMALL_BENCH+ , weigh default-language: Haskell2010