uhc-util-0.1.7.0: UHC utilities

Safe HaskellSafe
LanguageHaskell98

UHC.Util.Rel

Description

Relation via Set of tuples

Synopsis

Documentation

type Rel a b = Set (a, b) Source #

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

mapDom :: (Ord a, Ord b, Ord x) => (a -> x) -> Rel a b -> Rel x b Source #

Map domain

mapRng :: (Ord a, Ord b, Ord x) => (b -> x) -> Rel a b -> Rel a x Source #

Map range

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

Partition domain

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

Partition range

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

Intersect jointly on domain and range

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

Difference jointly on domain and 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

mapDomRng :: (Ord a, Ord b, Ord a', Ord b') => ((a, b) -> (a', b')) -> Rel a b -> Rel a' b' Source #

Map over domain and range