uhc-util-0.1.4.0: UHC utilities

Safe HaskellSafe-Inferred
LanguageHaskell98

UHC.Util.RelMap

Description

Relation via pair of maps for domain and range. Incomplete w.r.t. corresponding UHC.Util.Rel

Synopsis

Documentation

data Rel a b Source

Relation, represented as 2 maps from domain to range and the inverse, thus allowing faster lookup at the expense of some set like operations more expensive.

empty :: Rel a b Source

Empty relation

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

As assocation list

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

From association list

singleton :: (Ord a, Ord b) => a -> b -> Rel a b Source

Singleton relation

dom :: (Ord a, Ord b) => Rel a b -> Set a Source

Domain of relation

rng :: (Ord a, Ord b) => Rel a b -> Set b Source

Range of relation

restrictDom :: (Ord a, Ord b) => (a -> Bool) -> Rel a b -> Rel a b Source

Filter on domain

restrictRng :: (Ord a, Ord b) => (b -> Bool) -> Rel a b -> Rel a b Source

Filter on range

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

Union

unions :: (Ord a, Ord b) => [Rel a b] -> Rel a b Source

Union of list of relations

apply :: (Ord a, Ord b) => Rel a b -> a -> [b] Source

Apply relation as a function

toDomMap :: Ord a => Rel a b -> Map a [b] Source

As a Map keyed on domain

toRngMap :: Ord b => Rel a b -> Map b [a] Source

As a Map keyed on range