more-containers-0.1.2.0: A few more collections

Safe HaskellSafe
LanguageHaskell2010

Data.Multimap.Internal

Description

Internal multimap module; standard disclaimers apply.

Synopsis

Documentation

newtype Multimap k c v Source #

Constructors

Multimap 

Fields

Instances
Functor c => Functor (Multimap k c) Source # 
Instance details

Defined in Data.Multimap.Internal

Methods

fmap :: (a -> b) -> Multimap k c a -> Multimap k c b #

(<$) :: a -> Multimap k c b -> Multimap k c a #

Collection c => Foldable (Multimap k c) Source # 
Instance details

Defined in Data.Multimap.Internal

Methods

fold :: Monoid m => Multimap k c m -> m #

foldMap :: Monoid m => (a -> m) -> Multimap k c a -> m #

foldr :: (a -> b -> b) -> b -> Multimap k c a -> b #

foldr' :: (a -> b -> b) -> b -> Multimap k c a -> b #

foldl :: (b -> a -> b) -> b -> Multimap k c a -> b #

foldl' :: (b -> a -> b) -> b -> Multimap k c a -> b #

foldr1 :: (a -> a -> a) -> Multimap k c a -> a #

foldl1 :: (a -> a -> a) -> Multimap k c a -> a #

toList :: Multimap k c a -> [a] #

null :: Multimap k c a -> Bool #

length :: Multimap k c a -> Int #

elem :: Eq a => a -> Multimap k c a -> Bool #

maximum :: Ord a => Multimap k c a -> a #

minimum :: Ord a => Multimap k c a -> a #

sum :: Num a => Multimap k c a -> a #

product :: Num a => Multimap k c a -> a #

(Eq k, Eq (c v)) => Eq (Multimap k c v) Source # 
Instance details

Defined in Data.Multimap.Internal

Methods

(==) :: Multimap k c v -> Multimap k c v -> Bool #

(/=) :: Multimap k c v -> Multimap k c v -> Bool #

(Ord k, Ord (c v)) => Ord (Multimap k c v) Source # 
Instance details

Defined in Data.Multimap.Internal

Methods

compare :: Multimap k c v -> Multimap k c v -> Ordering #

(<) :: Multimap k c v -> Multimap k c v -> Bool #

(<=) :: Multimap k c v -> Multimap k c v -> Bool #

(>) :: Multimap k c v -> Multimap k c v -> Bool #

(>=) :: Multimap k c v -> Multimap k c v -> Bool #

max :: Multimap k c v -> Multimap k c v -> Multimap k c v #

min :: Multimap k c v -> Multimap k c v -> Multimap k c v #

(Ord k, Read k, Read (c v)) => Read (Multimap k c v) Source # 
Instance details

Defined in Data.Multimap.Internal

(Show k, Show (c v)) => Show (Multimap k c v) Source # 
Instance details

Defined in Data.Multimap.Internal

Methods

showsPrec :: Int -> Multimap k c v -> ShowS #

show :: Multimap k c v -> String #

showList :: [Multimap k c v] -> ShowS #

(Ord k, Semigroup (c v)) => Semigroup (Multimap k c v) Source # 
Instance details

Defined in Data.Multimap.Internal

Methods

(<>) :: Multimap k c v -> Multimap k c v -> Multimap k c v #

sconcat :: NonEmpty (Multimap k c v) -> Multimap k c v #

stimes :: Integral b => b -> Multimap k c v -> Multimap k c v #

(Ord k, Semigroup (c v)) => Monoid (Multimap k c v) Source # 
Instance details

Defined in Data.Multimap.Internal

Methods

mempty :: Multimap k c v #

mappend :: Multimap k c v -> Multimap k c v -> Multimap k c v #

mconcat :: [Multimap k c v] -> Multimap k c v #

null :: Multimap k c v -> Bool Source #

size :: Collection c => Multimap k c v -> Int Source #

singleton :: (Collection c, Ord k) => k -> v -> Multimap k c v Source #

fromMap :: Collection c => Map k (c v) -> Multimap k c v Source #

fromList :: (Collection c, Semigroup (c v), Ord k) => [(k, v)] -> Multimap k c v Source #

Build a multimap from a list.

This method uses insertWith and semigroup's <> operator. This might not be what you want, for example in the case of lists (where the order of the values will be inverted). For ordered collections, prefer fromCollectionsList.

fromCollectionsList :: (Collection c, Semigroup (c v), Ord k) => [(k, c v)] -> Multimap k c v Source #

Build a multimap from a list of key-collection pairs.

member :: (Collection c, Ord k) => k -> Multimap k c v -> Bool Source #

notMember :: (Collection c, Ord k) => k -> Multimap k c v -> Bool Source #

(!) :: (Collection c, Ord k) => Multimap k c v -> k -> c v Source #

insert :: (Ord k, Collection c, Semigroup (c v)) => k -> v -> Multimap k c v -> Multimap k c v Source #

insertAll :: (Ord k, Semigroup (c v)) => k -> c v -> Multimap k c v -> Multimap k c v Source #

deleteAll :: Ord k => k -> Multimap k c v -> Multimap k c v Source #

filter :: (Collection c, Semigroup (c v), Ord k) => (v -> Bool) -> Multimap k c v -> Multimap k c v Source #

filterWithKey :: (Collection c, Semigroup (c v), Ord k) => (k -> v -> Bool) -> Multimap k c v -> Multimap k c v Source #

union :: (Ord k, Semigroup (c v)) => Multimap k c v -> Multimap k c v -> Multimap k c v Source #

toMap :: Multimap k c v -> Map k (c v) Source #

toMapWith :: (c v -> a) -> Multimap k c v -> Map k a Source #

toList :: Collection c => Multimap k c v -> [(k, v)] Source #

keys :: Multimap k c v -> [k] Source #

keysSet :: Multimap k c v -> Set k Source #

lift1 :: (Ord k, Collection c) => (c v -> c v) -> k -> Multimap k c v -> Multimap k c v Source #

Lift an operation over a collection of values into a multimap operation.

Sample use to filter even values from a SetMultimap:

   let ms = fromList [('a', 1), ('a', 2)] :: SetMultimap Char Int
   lift1 (Set.filter even) 'a' ms == fromList [('a', 1)]

liftF1 :: (Ord k, Collection c, Functor f) => (c v -> f (c v)) -> k -> Multimap k c v -> f (Multimap k c v) Source #

Applicative version of lift1