Hets - the Heterogeneous Tool Set

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

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) Source #

remove empty elements from the map

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

get elements for a key

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

all elementes united

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

test for an element under a key

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

insert into a set of values

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

test all elements of a set

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

difference function for differenceWith, returns Nothing for empty sets

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

convert a set into an identity map

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

restrict a map by a keys set

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

the image of a map

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

the image of a map

data MapSet a b Source #

a map to non-empty sets

Instances

(Eq b, Eq a) => Eq (MapSet a b) Source # 

Methods

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

(/=) :: MapSet a b -> MapSet a b -> Bool

(Ord a, Ord b, Data b, Data a) => Data (MapSet a b) Source # 

Methods

gfoldl :: (forall d c. Data d => c (d -> c) -> d -> c c) -> (forall g. g -> c g) -> MapSet a b -> c (MapSet a b)

gunfold :: (forall c r. Data c => c (c -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (MapSet a b)

toConstr :: MapSet a b -> Constr

dataTypeOf :: MapSet a b -> DataType

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (MapSet a b))

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (MapSet a b))

gmapT :: (forall c. Data c => c -> c) -> MapSet a b -> MapSet a b

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MapSet a b -> r

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MapSet a b -> r

gmapQ :: (forall d. Data d => d -> u) -> MapSet a b -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> MapSet a b -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> MapSet a b -> m (MapSet a b)

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MapSet a b -> m (MapSet a b)

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MapSet a b -> m (MapSet a b)

(Ord b, Ord a) => Ord (MapSet a b) Source # 

Methods

compare :: MapSet a b -> MapSet a b -> Ordering

(<) :: MapSet a b -> MapSet a b -> Bool

(<=) :: MapSet a b -> MapSet a b -> Bool

(>) :: MapSet a b -> MapSet a b -> Bool

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

max :: MapSet a b -> MapSet a b -> MapSet a b

min :: MapSet a b -> MapSet a b -> MapSet a b

(Ord a, Read a, Ord b, Read b) => Read (MapSet a b) Source # 

Methods

readsPrec :: Int -> ReadS (MapSet a b)

readList :: ReadS [MapSet a b]

readPrec :: ReadPrec (MapSet a b)

readListPrec :: ReadPrec [MapSet a b]

(Show a, Show b) => Show (MapSet a b) Source # 

Methods

showsPrec :: Int -> MapSet a b -> ShowS

show :: MapSet a b -> String

showList :: [MapSet a b] -> ShowS

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

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

unsafe variant of fromMap (without removal of empty sets)

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

remove empty values from the map before applying wrapping constructor

empty :: MapSet a b Source #

the empty relation

null :: MapSet a b -> Bool Source #

test for the empty mapping

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

convert from a list

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

convert to a list

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

keysSet :: MapSet a b -> Set a Source #

keys for non-empty elements

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

all elementes united

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

insert an element under the given key

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

update an element set under the given key

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

get elements for a key

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

test for an element under a key

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

delete an element under the given key

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

union of two maps

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

difference of two maps

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

intersection of two maps

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

map a function to all elements

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

unsafe map a function to all elements

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

apply a function to all element sets

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

fold over all elements

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

filter elements

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

partition elements

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

filter complete entries

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

test all elements

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

submap test

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

pre-image of a map

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

transpose a map set