distributed-process-extras 0.3.1 → 0.3.2
raw patch · 4 files changed
+13/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Distributed.Process.Extras.Internal.Containers.MultiMap: delete :: (Insertable k) => k -> MultiMap k v -> Maybe ([v], MultiMap k v)
+ Control.Distributed.Process.Extras.Internal.Queue.SeqQ: filter :: (a -> Bool) -> SeqQ a -> SeqQ a
Files
- distributed-process-extras.cabal +1/−1
- src/Control/Distributed/Process/Extras/Internal/Containers/MultiMap.hs +5/−0
- src/Control/Distributed/Process/Extras/Internal/Queue/PriorityQ.hs +0/−1
- src/Control/Distributed/Process/Extras/Internal/Queue/SeqQ.hs +7/−2
distributed-process-extras.cabal view
@@ -1,5 +1,5 @@ name: distributed-process-extras-version: 0.3.1+version: 0.3.2 cabal-version: >=1.8 build-type: Simple license: BSD3
src/Control/Distributed/Process/Extras/Internal/Containers/MultiMap.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE TupleSections #-} module Control.Distributed.Process.Extras.Internal.Containers.MultiMap ( MultiMap@@ -10,6 +11,7 @@ , insert , member , lookup+ , delete , filter , filterWithKey , toList@@ -58,6 +60,9 @@ lookup :: (Insertable k) => k -> MultiMap k v -> Maybe [v] lookup k M{..} = maybe Nothing (Just . Foldable.toList) $ Map.lookup k hmap {-# INLINE lookup #-}++delete :: (Insertable k) => k -> MultiMap k v -> Maybe ([v], MultiMap k v)+delete k m@M{..} = maybe Nothing (Just . (, M $ Map.delete k hmap)) $ lookup k m filter :: forall k v. (Insertable k) => (v -> Bool)
src/Control/Distributed/Process/Extras/Internal/Queue/PriorityQ.hs view
@@ -35,4 +35,3 @@ {-# INLINE peek #-} peek :: Ord k => PriorityQ k v -> Maybe v peek p = maybe Nothing (\(v, _) -> Just v) $ dequeue p-
src/Control/Distributed/Process/Extras/Internal/Queue/SeqQ.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE NoImplicitPrelude #-} module Control.Distributed.Process.Extras.Internal.Queue.SeqQ ( SeqQ , empty@@ -6,18 +7,19 @@ , enqueue , dequeue , peek+ , filter ) where -- A simple FIFO queue implementation backed by @Data.Sequence@.-+import Prelude hiding (filter) import Data.Sequence ( Seq , ViewR(..) , (<|) , viewr )-import qualified Data.Sequence as Seq (empty, singleton, null)+import qualified Data.Sequence as Seq (empty, singleton, null, filter) newtype SeqQ a = SeqQ { q :: Seq a } deriving (Show)@@ -47,6 +49,9 @@ {-# INLINE peek #-} peek :: SeqQ a -> Maybe a peek s = maybe Nothing (\(_ :> a) -> Just a) $ getR s++filter :: (a -> Bool) -> SeqQ a -> SeqQ a+filter c s = SeqQ $ Seq.filter c (q s) getR :: SeqQ a -> Maybe (ViewR a) getR s =