Hets - the Heterogeneous Tool Set

Copyright(c) DFKI GmbH 2011
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerChristian.Maeder@dfki.de
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred

Common.Lib.MapSet

Description

supply total mappings from keys to sets of values based on Data.Map. Undefined keys are mapped to the empty set. An abstract data type is needed to avoid differences due to empty set values versus undefined map keys.

Synopsis

Documentation

rmNullSets :: Ord a => Map a (Set b) -> Map a (Set b)

remove empty elements from the map

setLookup :: Ord a => a -> Map a (Set b) -> Set b

get elements for a key

setElems :: Ord b => Map a (Set b) -> Set b

all elementes united

setMember :: (Ord a, Ord b) => a -> b -> Map a (Set b) -> Bool

test for an element under a key

setInsert :: (Ord k, Ord a) => k -> a -> Map k (Set a) -> Map k (Set a)

insert into a set of values

setAll :: (a -> Bool) -> Set a -> Bool

test all elements of a set

setDifference :: Ord a => Set a -> Set a -> Maybe (Set a)

difference function for differenceWith, returns Nothing for empty sets

setToMap :: Ord a => Set a -> Map a a

convert a set into an identity map

restrict :: Ord k => Map k a -> Set k -> Map k a

restrict a map by a keys set

imageList :: Ord k => Map k a -> Set k -> [a]

the image of a map

imageSet :: (Ord k, Ord a) => Map k a -> Set k -> Set a

the image of a map

data MapSet a b

a map to non-empty sets

Instances

(Eq a, Eq b) => Eq (MapSet a b) 
(Data a, Data b, Ord a, Ord b) => Data (MapSet a b) 
(Ord a, Ord b) => Ord (MapSet a b) 
(Ord a, Read a, Ord b, Read b) => Read (MapSet a b) 
(Show a, Show b) => Show (MapSet a b) 
(Ord a, ShATermConvertible a, Ord b, ShATermConvertible b) => ShATermConvertible (MapSet a b) 
Typeable (* -> * -> *) MapSet 

toMap :: MapSet a b -> Map a (Set b)

fromDistinctMap :: Map a (Set b) -> MapSet a b

unsafe variant of fromMap (without removal of empty sets)

fromMap :: Ord a => Map a (Set b) -> MapSet a b

remove empty values from the map before applying wrapping constructor

empty :: MapSet a b

the empty relation

null :: MapSet a b -> Bool

test for the empty mapping

fromList :: (Ord a, Ord b) => [(a, [b])] -> MapSet a b

convert from a list

toList :: MapSet a b -> [(a, [b])]

convert to a list

toPairList :: MapSet a b -> [(a, b)]

keysSet :: MapSet a b -> Set a

keys for non-empty elements

elems :: Ord b => MapSet a b -> Set b

all elementes united

insert :: (Ord a, Ord b) => a -> b -> MapSet a b -> MapSet a b

insert an element under the given key

update :: (Ord a, Ord b) => (Set b -> Set b) -> a -> MapSet a b -> MapSet a b

update an element set under the given key

lookup :: Ord a => a -> MapSet a b -> Set b

get elements for a key

member :: (Ord a, Ord b) => a -> b -> MapSet a b -> Bool

test for an element under a key

delete :: (Ord a, Ord b) => a -> b -> MapSet a b -> MapSet a b

delete an element under the given key

union :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> MapSet a b

union of two maps

difference :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> MapSet a b

difference of two maps

intersection :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> MapSet a b

intersection of two maps

map :: (Ord b, Ord c) => (b -> c) -> MapSet a b -> MapSet a c

map a function to all elements

mapMonotonic :: (b -> c) -> MapSet a b -> MapSet a c

unsafe map a function to all elements

mapSet :: Ord a => (Set b -> Set c) -> MapSet a b -> MapSet a c

apply a function to all element sets

foldWithKey :: (a -> b -> c -> c) -> c -> MapSet a b -> c

fold over all elements

filter :: (Ord a, Ord b) => (b -> Bool) -> MapSet a b -> MapSet a b

filter elements

partition :: (Ord a, Ord b) => (b -> Bool) -> MapSet a b -> (MapSet a b, MapSet a b)

partition elements

filterWithKey :: Ord a => (a -> Set b -> Bool) -> MapSet a b -> MapSet a b

filter complete entries

all :: Ord b => (b -> Bool) -> MapSet a b -> Bool

test all elements

isSubmapOf :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> Bool

submap test

preImage :: (Ord a, Ord b) => Map a b -> MapSet b a

pre-image of a map

transpose :: (Ord a, Ord b) => MapSet a b -> MapSet b a

transpose a map set