PSQueue 1.2.0 → 1.2.1
raw patch · 4 files changed
+28/−22 lines, 4 filesdep +tastydep +tasty-quickcheckPVP ok
version bump matches the API change (PVP)
Dependencies added: tasty, tasty-quickcheck
API changes (from Hackage documentation)
Files
- ChangeLog.md +9/−0
- PSQueue.cabal +6/−4
- src/Data/PSQueue/Internal.hs +4/−6
- test/Test.hs +9/−12
ChangeLog.md view
@@ -1,3 +1,12 @@++### 1.2.1+- Move Changelog.md to extra-doc-files section [#17](https://github.com/PSQueue/PSQueue/pull/17)+- Use tasty in test suite [#16](https://github.com/PSQueue/PSQueue/pull/16)+- Fix tree balancing logic (Thanks to @chowells79) [#15](https://github.com/PSQueue/PSQueue/pull/15)+- Support GHC-9.12 [#13](https://github.com/PSQueue/PSQueue/pull/13)+- Support GHC-9.10 [#12](https://github.com/PSQueue/PSQueue/pull/12)+- Support GHC-9.8 [#11](https://github.com/PSQueue/PSQueue/pull/11)+ ### 1.2.0 - Fix typos (Thanks to @Moiman) [#8](https://github.com/PSQueue/PSQueue/pull/8)
PSQueue.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: PSQueue-version: 1.2.0+version: 1.2.1 build-type: Simple license: BSD3 license-file: LICENSE@@ -18,8 +18,8 @@ can be retrieved in constant time. A queue can be built from a list of bindings, sorted by keys, in linear time. -tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.1 || ==9.6.1-extra-source-files: ChangeLog.md+tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.1 || ==9.6.1 || ==9.8.1 || ==9.10.1 || ==9.12.1+extra-doc-files: ChangeLog.md source-repository head type: git@@ -36,7 +36,7 @@ if impl(ghc >7.2) default-extensions: Safe - build-depends: base >=4.3 && <4.19+ build-depends: base >=4.3 && <4.22 test-suite test type: exitcode-stdio-1.0@@ -47,3 +47,5 @@ base , PSQueue , QuickCheck < 3+ , tasty <1.6+ , tasty-quickcheck <0.12
src/Data/PSQueue/Internal.hs view
@@ -466,19 +466,17 @@ lbalance, rbalance :: Ord p => k -> p -> LTree k p -> k -> LTree k p -> LTree k p -lbalance k p Start m r = lloser k p Start m r-lbalance k p l m Start = lloser k p l m Start lbalance k p l m r+ | size' r + size' l < 2 = lloser k p l m r | size' r > omega * size' l = lbalanceLeft k p l m r | size' l > omega * size' r = lbalanceRight k p l m r- | otherwise = lloser k p l m r+ | otherwise = lloser k p l m r -rbalance k p Start m r = rloser k p Start m r-rbalance k p l m Start = rloser k p l m Start rbalance k p l m r+ | size' r + size' l < 2 = rloser k p l m r | size' r > omega * size' l = rbalanceLeft k p l m r | size' l > omega * size' r = rbalanceRight k p l m r- | otherwise = rloser k p l m r+ | otherwise = rloser k p l m r {-# INLINABLE lbalanceLeft #-} lbalanceLeft :: Ord p => k -> p -> LTree k p -> k -> LTree k p -> LTree k p
test/Test.hs view
@@ -2,6 +2,8 @@ import Data.PSQueue.Internal import Test.QuickCheck+import Test.Tasty+import Test.Tasty.QuickCheck import Data.List (sort) isBalanced Start = True@@ -47,15 +49,10 @@ Nothing -> True Just (b2,_) -> prio b1 <= prio b2 && prop_MinView t' -main =- do- putStrLn "Balanced"- quickCheck prop_Balanced- putStrLn "OrderedKeys"- quickCheck prop_OrderedKeys- putStrLn "MinView"- quickCheck prop_MinView- putStrLn "AtMost"- quickCheck prop_AtMost- putStrLn "AtMostRange"- quickCheck prop_AtMostRange+main = defaultMain $ testGroup "Tests"+ [ testProperty "Balanced" prop_Balanced+ , testProperty "OrderedKeys" prop_OrderedKeys+ , testProperty "MinView" prop_MinView+ , testProperty "AtMost" prop_AtMost+ , testProperty "AtMostRange" prop_AtMostRange+ ]