Copyright | (C) 2017 ATS Advanced Telematic Systems GmbH |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Stevan Andjelkovic <stevan@advancedtelematic.com> |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
This module contains Z-inspried combinators for working with relations. The idea is that they can be used to define concise and showable models. This module is an experiment and will likely change or move to its own package.
- union :: Eq a => [a] -> [a] -> [a]
- intersect :: Eq a => [a] -> [a] -> [a]
- isSubsetOf :: Eq a => [a] -> [a] -> Bool
- (~=) :: Eq a => [a] -> [a] -> Bool
- type Rel a b = [(a, b)]
- type Fun a b = Rel a b
- empty :: Rel a b
- identity :: [a] -> Rel a a
- singleton :: a -> b -> Rel a b
- domain :: Rel a b -> [a]
- codomain :: Rel a b -> [b]
- compose :: Eq b => Rel b c -> Rel a b -> Rel a c
- fcompose :: Eq b => Rel a b -> Rel b c -> Rel a c
- inverse :: Rel a b -> Rel b a
- lookupDom :: Eq a => a -> Rel a b -> [b]
- lookupCod :: Eq b => b -> Rel a b -> [a]
- (<|) :: Eq a => [a] -> Rel a b -> Rel a b
- (|>) :: Eq b => Rel a b -> [b] -> Rel a b
- (<-|) :: Eq a => [a] -> Rel a b -> Rel a b
- (|->) :: Eq b => Rel a b -> [b] -> Rel a b
- image :: Eq a => Rel a b -> [a] -> [b]
- (<+) :: (Eq a, Eq b) => Rel a b -> Rel a b -> Rel a b
- (<**>) :: Eq a => Rel a b -> Rel a c -> Rel a (b, c)
- (<||>) :: Rel a c -> Rel b d -> Rel (a, b) (c, d)
- isTotalRel :: Eq a => Rel a b -> [a] -> Bool
- isSurjRel :: Eq b => Rel a b -> [b] -> Bool
- isTotalSurjRel :: (Eq a, Eq b) => Rel a b -> [a] -> [b] -> Bool
- isPartialFun :: (Eq a, Eq b) => Rel a b -> Bool
- isTotalFun :: (Eq a, Eq b) => Rel a b -> [a] -> Bool
- isPartialInj :: (Eq a, Eq b) => Rel a b -> Bool
- isTotalInj :: (Eq a, Eq b) => Rel a b -> [a] -> Bool
- isPartialSurj :: (Eq a, Eq b) => Rel a b -> [b] -> Bool
- isTotalSurj :: (Eq a, Eq b) => Rel a b -> [a] -> [b] -> Bool
- isBijection :: (Eq a, Eq b) => Rel a b -> [a] -> [b] -> Bool
- (!) :: (Eq a, Show a, Show b) => Fun a b -> a -> b
- (.%) :: (Eq a, Eq b, Show a, Show b) => (Fun a b, a) -> (b -> b) -> Fun a b
- (.!) :: Rel a b -> a -> (Rel a b, a)
- (.=) :: (Eq a, Eq b) => (Rel a b, a) -> b -> Rel a b
Documentation
isSubsetOf :: Eq a => [a] -> [a] -> Bool Source #
(<|) :: Eq a => [a] -> Rel a b -> Rel a b Source #
Domain restriction.
>>>
['a'] <| [ ('a', "apa"), ('b', "bepa") ]
[('a',"apa")]
(|>) :: Eq b => Rel a b -> [b] -> Rel a b Source #
Codomain restriction.
>>>
[ ('a', "apa"), ('b', "bepa") ] |> ["apa"]
[('a',"apa")]
(<-|) :: Eq a => [a] -> Rel a b -> Rel a b Source #
Domain substraction.
>>>
['a'] <-| [ ('a', "apa"), ('b', "bepa") ]
[('b',"bepa")]
(|->) :: Eq b => Rel a b -> [b] -> Rel a b Source #
Codomain substraction.
>>>
[ ('a', "apa"), ('b', "bepa") ] |-> ["apa"]
[('b',"bepa")]