packages feed

sorted-list 0.2.1.2 → 0.2.2.0

raw patch · 5 files changed

+18/−3 lines, 5 filessetup-changed

Files

Data/SortedList.hs view
@@ -22,6 +22,7 @@   , insert     -- * Deleting   , delete+  , deleteAll     -- * Sublists   , take   , drop@@ -222,6 +223,17 @@         LT -> x : go xs         GT -> x : xs         EQ -> xs+    go [] = []++-- | Delete /all/ occurrences of the given element.+deleteAll :: Ord a => a -> SortedList a -> SortedList a+deleteAll a (SortedList l) = SortedList $ go l+  where+    go (x:xs) =+      case x `compare` a of+        LT -> x : go xs+        GT -> x : xs+        EQ -> go xs     go [] = []  -- | Extract the prefix with the given length from a sorted list.
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
changelog.md view
@@ -1,3 +1,6 @@+## 0.2.2.0+* Add `deleteAll`.+ ## 0.2.1.2 * Use `compare` instead of inequalities in `delete` implementation. * Add test.
sorted-list.cabal view
@@ -1,5 +1,5 @@ name:                sorted-list-version:             0.2.1.2+version:             0.2.2.0 synopsis:            Type-enforced sorted lists and related functions. description:         Type-enforced sorted lists and related functions.                      .
tests/Main.hs view
@@ -36,6 +36,8 @@     \x xs -> let ys :: SortedList Int                  ys = SL.toSortedList $ x : xs              in  SL.delete x ys == applyAsList (List.delete x) ys+  quickCheck "deleteAll" $+    \x xs -> SL.deleteAll (x :: Int) xs == SL.filter (/=x) xs   quickCheck "elemOrd" $     \x xs -> SL.elemOrd x xs == List.elem (x :: Int) (SL.fromSortedList xs)   quickCheck "nub" $