Data.DualMap
 Portability probably not portable Stability experimental Maintainer jupdike@gmail.com
Description
Abstractly, a DualMap is a two way finite map (item --> val and val --> item) or assoc list that allows duplicate items and values as long as the pairs themselves are unique. Both items and values are stored in order so DualMap is designed for queries on large ordered subsets (open or closed intervals) of values (or items).
Synopsis
data DualMap i v
dmFlip :: DualMap i v -> DualMap v i
toList :: DualMap i v -> [(i, v)]
fromList :: (Ord i, Ord v) => [(i, v)] -> DualMap i v
map :: (Ord i, Ord a, Ord b) => (a -> b) -> DualMap i a -> DualMap i b
empty :: DualMap i v
null :: DualMap i v -> Bool
insert :: (Ord i, Ord v) => i -> v -> DualMap i v -> DualMap i v
union :: (Ord i, Ord v) => DualMap i v -> DualMap i v -> DualMap i v
hasPair :: (Ord i, Ord v) => i -> v -> DualMap i v -> Bool
notHasPair :: (Ord i, Ord v) => i -> v -> DualMap i v -> Bool
hasItem :: (Ord i, Ord v) => i -> DualMap i v -> Bool
notHasItem :: (Ord i, Ord v) => i -> DualMap i v -> Bool
hasValue :: (Ord i, Ord v) => v -> DualMap i v -> Bool
notHasValue :: (Ord i, Ord v) => v -> DualMap i v -> Bool
deleteItem :: (Ord i, Ord v) => i -> DualMap i v -> DualMap i v
deleteItems :: (Ord i, Ord v) => [i] -> DualMap i v -> DualMap i v
deleteVal :: (Ord i, Ord v) => v -> DualMap i v -> DualMap i v
deleteVals :: (Ord i, Ord v) => [v] -> DualMap i v -> DualMap i v
deletePair :: (Ord i, Ord v) => i -> v -> DualMap i v -> DualMap i v
renameValue :: (Ord i, Ord v) => v -> v -> DualMap i v -> DualMap i v
setValue :: (Ord i, Ord v) => i -> v -> DualMap i v -> DualMap i v
setValues :: (Ord i, Ord v) => i -> [v] -> DualMap i v -> DualMap i v
lookupValsByItem :: (Ord i, Ord v) => i -> DualMap i v -> Set v
lookupItemsByVal :: (Ord i, Ord v) => v -> DualMap i v -> Set i
data Start a
 = First | GtEq a | Gt a
data Stop a
 = Last | LtEq a | Lt a
queryByItems :: Ord i => Start i -> Stop i -> DualMap i v -> [(i, v)]
queryByVals :: (Ord i, Ord v) => Start v -> Stop v -> DualMap i v -> [(v, i)]
queryItemsByVals :: (Ord i, Ord v) => Start v -> Stop v -> DualMap i v -> Set i
Documentation
data DualMap i v

Abstrcatly, a DualMap is a double-way finite map (item --> val and val --> item) or assoc list that allows duplicate items and values as long as the pairs themselves are unique.

For example, inserting the following pairs:

``` 1 <--> 'b'
1 <--> 'c'
2 <--> 'c'
```

==>

``` fromList [(1,'b'),(1,'c'),(2,'c')]
```

Looking up the item 1 yields Set.fromList [b,c] and 2 yields Set.fromList [c]. Looking up the value b yields Set.fromList [1] and looking up c yields Set.fromlist [1,2]

Instances
 Typeable2 DualMap (Eq i, Eq v) => Eq (DualMap i v) (Show i, Show v) => Show (DualMap i v)
dmFlip :: DualMap i v -> DualMap v i
toList :: DualMap i v -> [(i, v)]
fromList :: (Ord i, Ord v) => [(i, v)] -> DualMap i v
map :: (Ord i, Ord a, Ord b) => (a -> b) -> DualMap i a -> DualMap i b
empty :: DualMap i v
null :: DualMap i v -> Bool
insert :: (Ord i, Ord v) => i -> v -> DualMap i v -> DualMap i v
union :: (Ord i, Ord v) => DualMap i v -> DualMap i v -> DualMap i v
hasPair :: (Ord i, Ord v) => i -> v -> DualMap i v -> Bool
notHasPair :: (Ord i, Ord v) => i -> v -> DualMap i v -> Bool
hasItem :: (Ord i, Ord v) => i -> DualMap i v -> Bool
notHasItem :: (Ord i, Ord v) => i -> DualMap i v -> Bool
hasValue :: (Ord i, Ord v) => v -> DualMap i v -> Bool
notHasValue :: (Ord i, Ord v) => v -> DualMap i v -> Bool
deleteItem :: (Ord i, Ord v) => i -> DualMap i v -> DualMap i v
deleteItems :: (Ord i, Ord v) => [i] -> DualMap i v -> DualMap i v
deleteVal :: (Ord i, Ord v) => v -> DualMap i v -> DualMap i v
deleteVals :: (Ord i, Ord v) => [v] -> DualMap i v -> DualMap i v
deletePair :: (Ord i, Ord v) => i -> v -> DualMap i v -> DualMap i v
renameValue :: (Ord i, Ord v) => v -> v -> DualMap i v -> DualMap i v
setValue :: (Ord i, Ord v) => i -> v -> DualMap i v -> DualMap i v
setValues :: (Ord i, Ord v) => i -> [v] -> DualMap i v -> DualMap i v
lookupValsByItem :: (Ord i, Ord v) => i -> DualMap i v -> Set v
lookupItemsByVal :: (Ord i, Ord v) => v -> DualMap i v -> Set i
data Start a
Simple algebraic data types for describing (open or closed) intervals for queries
Constructors
 First GtEq a Gt a
Instances
 Eq a => Eq (Start a) Show a => Show (Start a)
data Stop a
Constructors
 Last LtEq a Lt a
Instances
 Eq a => Eq (Stop a) Show a => Show (Stop a)
queryByItems :: Ord i => Start i -> Stop i -> DualMap i v -> [(i, v)]
queryByVals :: (Ord i, Ord v) => Start v -> Stop v -> DualMap i v -> [(v, i)]
queryItemsByVals :: (Ord i, Ord v) => Start v -> Stop v -> DualMap i v -> Set i