distributed-process-0.7.2: Cloud Haskell: Erlang-style concurrency in Haskell

Safe HaskellSafe
LanguageHaskell98

Control.Distributed.Process.Internal.BiMultiMap

Description

This is an implementation of bidirectional multimaps.

Synopsis

Documentation

data BiMultiMap a b v Source #

A bidirectional multimaps BiMultiMap a b v is a set of triplets of type (a, b, v).

It is possible to lookup values by using either a or b as keys.

empty :: BiMultiMap a b v Source #

The empty bidirectional multimap.

singleton :: (Ord a, Ord b, Ord v) => a -> b -> v -> BiMultiMap a b v Source #

A bidirectional multimap containing a single triplet.

size :: BiMultiMap a b v -> Int Source #

Yields the amount of triplets in the multimap.

insert :: (Ord a, Ord b, Ord v) => a -> b -> v -> BiMultiMap a b v -> BiMultiMap a b v Source #

Inserts a triplet in the multimap.

lookupBy1st :: Ord a => a -> BiMultiMap a b v -> Set (b, v) Source #

Looks up all the triplets whose first component is the given value.

lookupBy2nd :: Ord b => b -> BiMultiMap a b v -> Set (a, v) Source #

Looks up all the triplets whose second component is the given value.

delete :: (Ord a, Ord b, Ord v) => a -> b -> v -> BiMultiMap a b v -> BiMultiMap a b v Source #

Deletes a triplet. It yields the original multimap if the triplet is not present.

deleteAllBy1st :: (Ord a, Ord b, Ord v) => a -> BiMultiMap a b v -> BiMultiMap a b v Source #

Deletes all triplets whose first component is the given value.

deleteAllBy2nd :: (Ord a, Ord b, Ord v) => b -> BiMultiMap a b v -> BiMultiMap a b v Source #

Like deleteAllBy1st but deletes by the second component of the triplets.

partitionWithKeyBy1st :: (Ord a, Ord b, Ord v) => (a -> Set (b, v) -> Bool) -> BiMultiMap a b v -> (Map a (Set (b, v)), BiMultiMap a b v) Source #

Yields the triplets satisfying the given predicate, and a multimap with all this triplets removed.

partitionWithKeyBy2nd :: (Ord a, Ord b, Ord v) => (b -> Set (a, v) -> Bool) -> BiMultiMap a b v -> (Map b (Set (a, v)), BiMultiMap a b v) Source #

Like partitionWithKeyBy1st but the predicates takes the second component of the triplets as first argument.

flip :: BiMultiMap a b v -> BiMultiMap b a v Source #

Exchange the first and the second components of all triplets.