packages feed

vector-algorithms 0.9.0.2 → 0.9.0.3

raw patch · 4 files changed

+20/−8 lines, 4 files

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## Version 0.9.0.3 (2024-11-25)++- Fix an off-by-one error Heap.partialSort functions.+- Support latest ghcs.+ ## Version 0.9.0.2 (2024-05-23)  - Add `TypeOperators` pragma where needed.
src/Data/Vector/Algorithms/Heap.hs view
@@ -188,8 +188,8 @@   | len == 3   = O.sort3ByOffset cmp a l   | len == 4   = O.sort4ByOffset cmp a l   | u <= l + k = sortByBounds cmp a l u-  | otherwise  = do selectByBounds cmp a k l u-                    sortHeap cmp a l (l + 4) (l + k)+  | otherwise  = do selectByBounds cmp a (k + 1) l u+                    sortHeap cmp a l (l + 4) (l + k + 1)                     O.sort4ByOffset cmp a l  where  len = u - l
tests/properties/Properties.hs view
@@ -97,8 +97,14 @@ prop_partialsort :: (Ord e, Arbitrary e, Show e)                  => (forall s mv. G.MVector mv e => mv s e -> Int -> ST s ())                  -> Positive Int -> Property-prop_partialsort = prop_sized $ \algo k ->-  prop_sorted . V.take k . modify algo+prop_partialsort = prop_sized $ \algo k v -> do+  let newVec = modify algo v+      vhead = V.take k newVec+      vtail = V.drop k newVec+  prop_sorted vhead+    .&&.+      -- Every element in the head should be < every element in the tail.+      if V.null vtail then 1 == 1 else V.maximum vhead <= V.minimum vtail  prop_sized_empty :: (Ord e) => (forall s. MV.MVector s e -> Int -> ST s ()) -> Property prop_sized_empty algo = prop_empty (flip algo 0) .&&. prop_empty (flip algo 10)
vector-algorithms.cabal view
@@ -1,6 +1,6 @@ cabal-version:     >= 1.10 name:              vector-algorithms-version:           0.9.0.2+version:           0.9.0.3 license:           BSD3 license-file:      LICENSE author:            Dan Doel@@ -18,7 +18,9 @@ extra-source-files: CHANGELOG.md  tested-with:-  GHC == 9.8.1+  GHC == 9.12.1+  GHC == 9.10.1+  GHC == 9.8.2   GHC == 9.6.3   GHC == 9.4.7   GHC == 9.2.8@@ -29,7 +31,6 @@   GHC == 8.4.4   GHC == 8.2.2   GHC == 8.0.2-  GHC == 7.10.3  flag BoundsChecks   description: Enable bounds checking@@ -160,7 +161,7 @@       base >= 4.9,       bytestring,       containers,-      QuickCheck > 2.9 && < 2.15,+      QuickCheck > 2.9 && < 2.16,       vector,       vector-algorithms