Copyright | (c) DFKI GmbH 2011 |
---|---|
License | GPLv2 or higher, see LICENSE.txt |
Maintainer | Christian.Maeder@dfki.de |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
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
- rmNullSets :: Ord a => Map a (Set b) -> Map a (Set b)
- setLookup :: Ord a => a -> Map a (Set b) -> Set b
- setElems :: Ord b => Map a (Set b) -> Set b
- setMember :: (Ord a, Ord b) => a -> b -> Map a (Set b) -> Bool
- setInsert :: (Ord k, Ord a) => k -> a -> Map k (Set a) -> Map k (Set a)
- setAll :: (a -> Bool) -> Set a -> Bool
- setDifference :: Ord a => Set a -> Set a -> Maybe (Set a)
- setToMap :: Ord a => Set a -> Map a a
- restrict :: Ord k => Map k a -> Set k -> Map k a
- imageList :: Ord k => Map k a -> Set k -> [a]
- imageSet :: (Ord k, Ord a) => Map k a -> Set k -> Set a
- data MapSet a b
- toMap :: MapSet a b -> Map a (Set b)
- fromDistinctMap :: Map a (Set b) -> MapSet a b
- fromMap :: Ord a => Map a (Set b) -> MapSet a b
- empty :: MapSet a b
- null :: MapSet a b -> Bool
- fromList :: (Ord a, Ord b) => [(a, [b])] -> MapSet a b
- toList :: MapSet a b -> [(a, [b])]
- toPairList :: MapSet a b -> [(a, b)]
- keysSet :: MapSet a b -> Set a
- elems :: Ord b => MapSet a b -> Set b
- insert :: (Ord a, Ord b) => a -> b -> MapSet a b -> MapSet a b
- update :: (Ord a, Ord b) => (Set b -> Set b) -> a -> MapSet a b -> MapSet a b
- lookup :: Ord a => a -> MapSet a b -> Set b
- member :: (Ord a, Ord b) => a -> b -> MapSet a b -> Bool
- delete :: (Ord a, Ord b) => a -> b -> MapSet a b -> MapSet a b
- union :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> MapSet a b
- difference :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> MapSet a b
- intersection :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> MapSet a b
- map :: (Ord b, Ord c) => (b -> c) -> MapSet a b -> MapSet a c
- mapMonotonic :: (b -> c) -> MapSet a b -> MapSet a c
- mapSet :: Ord a => (Set b -> Set c) -> MapSet a b -> MapSet a c
- foldWithKey :: (a -> b -> c -> c) -> c -> MapSet a b -> c
- filter :: (Ord a, Ord b) => (b -> Bool) -> MapSet a b -> MapSet a b
- partition :: (Ord a, Ord b) => (b -> Bool) -> MapSet a b -> (MapSet a b, MapSet a b)
- filterWithKey :: Ord a => (a -> Set b -> Bool) -> MapSet a b -> MapSet a b
- all :: Ord b => (b -> Bool) -> MapSet a b -> Bool
- isSubmapOf :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> Bool
- preImage :: (Ord a, Ord b) => Map a b -> MapSet b a
- transpose :: (Ord a, Ord b) => MapSet a b -> MapSet b a
Documentation
rmNullSets :: Ord a => Map a (Set b) -> Map a (Set b) Source #
remove empty elements from the map
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
setDifference :: Ord a => Set a -> Set a -> Maybe (Set a) Source #
difference function for differenceWith, returns Nothing for empty sets
a map to non-empty sets
Instances
(Eq a, Eq b) => Eq (MapSet a b) Source # | |
(Data a, Data b, Ord b, Ord a) => Data (MapSet a b) Source # | |
Defined in Common.Lib.MapSet gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> MapSet a b -> c (MapSet a b) gunfold :: (forall b0 r. Data b0 => c (b0 -> 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 b0. Data b0 => b0 -> b0) -> MapSet a b -> MapSet a b gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MapSet a b -> r gmapQr :: forall r r'. (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 a, Ord b) => Ord (MapSet a b) Source # | |
Defined in Common.Lib.MapSet | |
(Ord a, Read a, Ord b, Read b) => Read (MapSet a b) Source # | |
Defined in Common.Lib.MapSet | |
(Show a, Show b) => Show (MapSet a b) Source # | |
Generic (MapSet a b) Source # | |
(Ord a, FromJSON a, Ord b, FromJSON b, FromJSONKey a) => FromJSON (MapSet a b) | |
Defined in Common.Json.ConvInstances parseJSON :: Value -> Parser (MapSet a b) parseJSONList :: Value -> Parser [MapSet a b] | |
(Ord a, ToJSON a, Ord b, ToJSON b, ToJSONKey a) => ToJSON (MapSet a b) | |
Defined in Common.Json.ConvInstances toEncoding :: MapSet a b -> Encoding toJSONList :: [MapSet a b] -> Value toEncodingList :: [MapSet a b] -> Encoding | |
(Ord a, ShATermConvertible a, Ord b, ShATermConvertible b) => ShATermConvertible (MapSet a b) | |
Defined in Common.ATerm.ConvInstances toShATermAux :: ATermTable -> MapSet a b -> IO (ATermTable, Int) toShATermList' :: ATermTable -> [MapSet a b] -> IO (ATermTable, Int) fromShATermAux :: Int -> ATermTable -> (ATermTable, MapSet a b) fromShATermList' :: Int -> ATermTable -> (ATermTable, [MapSet a b]) | |
type Rep (MapSet a b) Source # | |
Defined in Common.Lib.MapSet type Rep (MapSet a b) = D1 ('MetaData "MapSet" "Common.Lib.MapSet" "main" 'True) (C1 ('MetaCons "MapSet" 'PrefixI 'True) (S1 ('MetaSel ('Just "toMap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map a (Set b))))) |
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
toPairList :: MapSet a b -> [(a, b)] Source #
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
delete :: (Ord a, Ord b) => a -> b -> MapSet a b -> MapSet a b Source #
delete an element under the given key
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
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
isSubmapOf :: (Ord a, Ord b) => MapSet a b -> MapSet a b -> Bool Source #
submap test