packages feed

depq 0.2.0.0 → 0.3.0.0

raw patch · 3 files changed

+17/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.DEPQ: size :: DEPQ p a -> Int

Files

ChangeLog.md view
@@ -1,4 +1,8 @@ # Changelog for depq +## 0.3+* Add 'size'+* Add dependency lower bounds+ ## 0.1 First release
depq.cabal view
@@ -1,5 +1,5 @@ name:           depq-version:        0.2.0.0+version:        0.3.0.0 synopsis:       Double-ended priority queues description:    Double-ended priority queues, for efficient retrieval of minimum and maximum elements in ordered collections of items. homepage:       https://github.com/ocramz/depq
src/Data/DEPQ.hs view
@@ -7,11 +7,13 @@ Based on `P.IntPSQ` : https://hackage.haskell.org/package/psqueues-0.2.7.2/docs/Data-IntPSQ.html -} module Data.DEPQ (-   DEPQ,+   DEPQ,     -- * Creation    empty, fromList,    -- * Predicates    null,+   -- * Properties+   size,     -- * Modification    insert, deleteMin, deleteMax, popMin, popMax,    -- * Lookup@@ -28,7 +30,7 @@ -- deepseq import Control.DeepSeq     (NFData (rnf)) -- psqueues-import qualified Data.IntPSQ as P (IntPSQ, empty, null, insert, delete, member, toList, fromList, findMin, delete, deleteMin)+import qualified Data.IntPSQ as P (IntPSQ, empty, null, size, insert, delete, member, toList, fromList, findMin, delete, deleteMin)  import Prelude hiding (null) @@ -61,6 +63,10 @@ empty :: DEPQ p a empty = DEPQ P.empty P.empty +-- | Number of elements in the DEPQ+size :: DEPQ p a -> Int+size (DEPQ p _) = P.size p+ -- | Populate a DEPQ from a 'Foldable' container (e.g. a list) fromList :: (Foldable t, Ord p) =>             t (Int, p, a) -- ^ (key, priority, value)@@ -120,10 +126,14 @@   pure (x, q')  -- | K highest-scoring entries in the DEPQ+--+-- NB : this returns an empty sequence if there are fewer than K elements in the DEPQ topK :: Ord p => Int -> DEPQ p v -> S.Seq (Int, p, v) topK = popK popMax  -- | K lowest-scoring entries in the DEPQ+--+-- NB : this returns an empty sequence if there are fewer than K elements in the DEPQ bottomK :: Ord p => Int -> DEPQ p v -> S.Seq (Int, p, v) bottomK = popK popMin