Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Relation via pair of maps for domain and range, for faster lookup in 2 directions. Incomplete w.r.t. corresponding UHC.Util.Rel
- data Rel a b
- empty :: Rel a b
- toDomList :: Rel a b -> [(a, [b])]
- toRngList :: Rel a b -> [([a], b)]
- toList :: Rel a b -> [(a, b)]
- fromList :: (Ord a, Ord b) => [(a, b)] -> Rel a b
- singleton :: (Ord a, Ord b) => a -> b -> Rel a b
- dom :: (Ord a, Ord b) => Rel a b -> Set a
- rng :: (Ord a, Ord b) => Rel a b -> Set b
- restrictDom :: (Ord a, Ord b) => (a -> Bool) -> Rel a b -> Rel a b
- restrictRng :: (Ord a, Ord b) => (b -> Bool) -> Rel a b -> Rel a b
- mapDom :: (Ord b, Ord x) => (a -> x) -> Rel a b -> Rel x b
- mapRng :: (Ord a, Ord x) => (b -> x) -> Rel a b -> Rel a x
- union :: (Ord a, Ord b) => Rel a b -> Rel a b -> Rel a b
- unions :: (Ord a, Ord b) => [Rel a b] -> Rel a b
- insert :: (Ord a, Ord b) => a -> b -> Rel a b -> Rel a b
- deleteDom :: (Ord a, Ord b) => a -> Rel a b -> Rel a b
- delete :: (Ord a, Ord b) => a -> Rel a b -> Rel a b
- deleteRng :: (Ord a, Ord b) => b -> Rel a b -> Rel a b
- applyDomMbSet :: Ord a => Rel a b -> a -> Maybe (Set b)
- applyRngMbSet :: Ord b => Rel a b -> b -> Maybe (Set a)
- applyDomSet :: Ord a => Rel a b -> a -> Set b
- applyRngSet :: Ord b => Rel a b -> b -> Set a
- applyDom :: Ord a => Rel a b -> a -> Maybe b
- applyRng :: Ord b => Rel a b -> b -> Maybe a
- apply :: Ord a => Rel a b -> a -> [b]
- applyInverse :: Ord b => Rel a b -> b -> [a]
- lookupDom :: Ord a => a -> Rel a b -> Maybe b
- lookupRng :: Ord b => b -> Rel a b -> Maybe a
- lookup :: Ord a => a -> Rel a b -> Maybe b
- lookupInverse :: Ord b => b -> Rel a b -> Maybe a
- toDomMap :: Ord a => Rel a b -> Map a [b]
- toRngMap :: Ord b => Rel a b -> Map b [a]
Documentation
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.
toDomList :: Rel a b -> [(a, [b])] Source #
As assocation list where each domain value only occurs once and the range as list
toRngList :: Rel a b -> [([a], b)] Source #
As assocation list where each range value only occurs once and the domain as list
applyDomMbSet :: Ord a => Rel a b -> a -> Maybe (Set b) Source #
Apply relation as a function, possible yielding a non empty set
applyRngMbSet :: Ord b => Rel a b -> b -> Maybe (Set a) Source #
Apply relation as an inverse function, possible yielding a non empty set
applyDomSet :: Ord a => Rel a b -> a -> Set b Source #
Apply relation as a function, yielding a possibly empty set
applyRngSet :: Ord b => Rel a b -> b -> Set a Source #
Apply relation as an inverse function, yielding a possibly empty set
applyDom :: Ord a => Rel a b -> a -> Maybe b Source #
Apply relation as a function, aka lookup, picking an arbitrary value in case of multiples
applyRng :: Ord b => Rel a b -> b -> Maybe a Source #
Apply relation as an inverse function, aka lookup, picking an arbitrary value in case of multiples
applyInverse :: Ord b => Rel a b -> b -> [a] Source #
Apply relation as an inverse function