stm-containers 1.0.1 → 1.0.1.1
raw patch · 3 files changed
+47/−63 lines, 3 filesdep +quickcheck-textdep ~basedep ~stm-hamtPVP ok
version bump matches the API change (PVP)
Dependencies added: quickcheck-text
Dependency ranges changed: base, stm-hamt
API changes (from Hackage documentation)
Files
- stm-containers.cabal +27/−48
- test/Main/MapTests.hs +18/−14
- test/Main/MapTests/Update.hs +2/−1
stm-containers.cabal view
@@ -1,9 +1,6 @@-name:- stm-containers-version:- 1.0.1-synopsis:- Containers for STM+name: stm-containers+version: 1.0.1.1+synopsis: Containers for STM description: This library is based on an STM-specialized implementation of Hash Array Mapped Trie.@@ -14,40 +11,26 @@ . For details on performance of the library, which are a bit outdated, see <http://nikita-volkov.github.io/stm-containers/ this blog post>.-category:- Data Structures, STM, Concurrency-homepage:- https://github.com/nikita-volkov/stm-containers-bug-reports:- https://github.com/nikita-volkov/stm-containers/issues-author:- Nikita Volkov <nikita.y.volkov@mail.ru>-maintainer:- Nikita Volkov <nikita.y.volkov@mail.ru>-copyright:- (c) 2014, Nikita Volkov-license:- MIT-license-file:- LICENSE-build-type:- Simple-cabal-version:- >=1.10+category: Data Structures, STM, Concurrency+homepage: https://github.com/nikita-volkov/stm-containers+bug-reports: https://github.com/nikita-volkov/stm-containers/issues+author: Nikita Volkov <nikita.y.volkov@mail.ru>+maintainer: Nikita Volkov <nikita.y.volkov@mail.ru>+copyright: (c) 2014, Nikita Volkov+license: MIT+license-file: LICENSE+build-type: Simple+cabal-version: >=1.10+tested-with: GHC ==8.0.2, GHC ==8.2.2, GHC ==8.4.2, GHC ==8.6.* source-repository head- type:- git- location:- git://github.com/nikita-volkov/stm-containers.git+ type: git+ location: git://github.com/nikita-volkov/stm-containers.git library- hs-source-dirs:- library- default-extensions:- Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, PatternSynonyms, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples- default-language:- Haskell2010+ hs-source-dirs: library+ default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, PatternSynonyms, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples+ default-language: Haskell2010 exposed-modules: StmContainers.Map StmContainers.Set@@ -56,25 +39,20 @@ other-modules: StmContainers.Prelude build-depends:- base <5,+ base >=4.9 && <5, deferred-folds >=0.6.6 && <0.7, focus >=1 && <1.1, hashable <2, list-t >=1.0.1 && <1.1,- stm-hamt >=1.1.2 && <1.2,+ stm-hamt >=1.1.2.1 && <1.2, transformers >=0.5 && <0.6 test-suite test- type:- exitcode-stdio-1.0- hs-source-dirs:- test- default-extensions:- Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, PatternSynonyms, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples- default-language:- Haskell2010- main-is:- Main.hs+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ default-extensions: Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, PatternSynonyms, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples+ default-language: Haskell2010+ main-is: Main.hs other-modules: Main.MapTests Main.MapTests.Update@@ -85,5 +63,6 @@ free >=4.6 && <6, HTF ==0.13.*, QuickCheck >=2.7 && <3,+ quickcheck-text >=0.1.2.1 && <0.2, rerebase >=1 && <2, stm-containers
test/Main/MapTests.hs view
@@ -4,6 +4,7 @@ import Prelude hiding (choose) import Test.Framework import Control.Monad.Free+import Data.Text.Arbitrary () import qualified Main.MapTests.Update as Update import qualified StmContainers.Map as StmMap import qualified Focus@@ -54,7 +55,7 @@ ------------------------- newtype TestKey = TestKey Word8- deriving (Eq, Show)+ deriving (Eq, Ord, Show) instance Arbitrary TestKey where arbitrary = TestKey <$> choose (0, 63)@@ -83,24 +84,27 @@ x <- stmMapFromList list StmMap.size x -prop_fromUnfoldMoListIsomorphism =- forAll gen prop- where- gen = do- keys <- nub <$> listOf (arbitrary :: Gen Char)- mapM (liftA2 (flip (,)) (arbitrary :: Gen Int) . pure) keys- prop list =- list \\ list' === []- where- list' = unsafePerformIO $ atomically $ stmMapFromList list >>= stmMapToList+prop_fromListToListHashMapIsomorphism =+ withQCArgs (\a -> a {maxSuccess = 10000}) $ \ (list :: [(Text, Int)]) -> let+ hashMapList = HashMap.toList (HashMap.fromList list)+ stmMapList = unsafePerformIO $ atomically $ stmMapFromList list >>= stmMapToList+ in sort hashMapList === sort stmMapList prop_updatesProduceTheSameEffectAsInHashMap =- withQCArgs (\a -> a {maxSuccess = 1000}) prop+ withQCArgs (\a -> a {maxSuccess = 100000}) prop where prop (updates :: [Update.Update TestKey ()]) =- interpretHashMapUpdate update === interpretStmMapUpdateAsHashMap update- where+ let update = sequence_ updates+ hashMap = interpretHashMapUpdate update+ hashMapSize = HashMap.size hashMap+ hashMapList = sort (HashMap.toList hashMap)+ (stmMapList, stmMapSize) = unsafePerformIO $ atomically $ do+ stmMap <- interpretStmMapUpdate update+ size <- StmMap.size stmMap+ stmMapList <- stmMapToList stmMap+ return (sort stmMapList, size)+ in (hashMapSize, hashMapList) === (stmMapSize, stmMapList) test_focusInsert = do assertEqual (HashMap.fromList [('a', 1), ('b', 2)]) =<< do
test/Main/MapTests/Update.hs view
@@ -36,7 +36,8 @@ where showsPrecInner = showsPrec (succ 5) -instance Show1 (UpdateF k v)+instance Show1 (UpdateF k v) where+ liftShowsPrec = undefined makeFree ''UpdateF