| Copyright | (c) Andrey Mulik 2019 |
|---|---|
| License | BSD-style |
| Maintainer | work.a.mulik@gmail.com |
| Portability | non-portable (GHC Extensions) |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
SDP.Set
Synopsis
- class Nullable s => SetWith s o | s -> o where
- setWith :: Compare o -> s -> s
- groupSetWith :: Compare o -> (o -> o -> o) -> s -> s
- insertWith :: Compare o -> o -> s -> s
- deleteWith :: Compare o -> o -> s -> s
- intersectionWith :: Compare o -> s -> s -> s
- differenceWith :: Compare o -> s -> s -> s
- symdiffWith :: Compare o -> s -> s -> s
- unionWith :: Compare o -> s -> s -> s
- intersectionsWith :: Foldable f => Compare o -> f s -> s
- differencesWith :: Foldable f => Compare o -> f s -> s
- unionsWith :: Foldable f => Compare o -> f s -> s
- symdiffsWith :: Foldable f => Compare o -> f s -> s
- isIntersectsWith :: Compare o -> s -> s -> Bool
- isDisjointWith :: Compare o -> s -> s -> Bool
- memberWith :: Compare o -> o -> s -> Bool
- isSubsetWith :: Compare o -> s -> s -> Bool
- subsets :: Ord o => s -> [s]
- lookupLTWith :: Compare o -> o -> s -> Maybe o
- lookupGTWith :: Compare o -> o -> s -> Maybe o
- lookupGEWith :: Compare o -> o -> s -> Maybe o
- lookupLEWith :: Compare o -> o -> s -> Maybe o
- type SetWith1 s o = SetWith (s o) o
- class Nullable s => Set s o | s -> o where
- set :: s -> s
- insert :: o -> s -> s
- delete :: o -> s -> s
- (/\) :: s -> s -> s
- (\/) :: s -> s -> s
- (\\) :: s -> s -> s
- (\^/) :: s -> s -> s
- (/?\) :: s -> s -> Bool
- (\?/) :: s -> s -> Bool
- (\+/) :: s -> s -> Bool
- intersections :: Foldable f => f s -> s
- unions :: Foldable f => f s -> s
- differences :: Foldable f => f s -> s
- symdiffs :: Foldable f => f s -> s
- member :: o -> s -> Bool
- lookupLT :: Ord o => o -> s -> Maybe o
- lookupGT :: Ord o => o -> s -> Maybe o
- lookupLE :: Ord o => o -> s -> Maybe o
- lookupGE :: Ord o => o -> s -> Maybe o
- type Set1 s o = Set (s o) o
SetWith
class Nullable s => SetWith s o | s -> o where Source #
SetWith is a class of data structures, that can represent sets.
SetWith doesn't provide data protection/validation before each first action.
All functions (except setWith) works correctly only with correct sets.
SetWith guarantee only that the returned data is correct. So if you need
maximum reliability and security, use containers. But if you want
simplicity, openness and a lot of non-set functions without extra conversions,
then you are at the right place.
Note that function of type Compare o must follow total order laws
(antisymmetry, transitivity and connexity). If you use the wrong comparator,
the result may become implementation-dependent.
Minimal complete definition
intersectionWith, unionWith, differenceWith, lookupLTWith, lookupGTWith
Methods
setWith :: Compare o -> s -> s Source #
Creates ordered set from linear structure.
groupSetWith :: Compare o -> (o -> o -> o) -> s -> s Source #
Creates set from linear structure using additional function for choice/merge equal elements.
default groupSetWith :: Linear s o => Compare o -> (o -> o -> o) -> s -> s Source #
insertWith :: Compare o -> o -> s -> s Source #
Adding element to set.
default insertWith :: Linear s o => Compare o -> o -> s -> s Source #
deleteWith :: Compare o -> o -> s -> s Source #
Deleting element from set.
default deleteWith :: Linear s o => Compare o -> o -> s -> s Source #
intersectionWith :: Compare o -> s -> s -> s Source #
Intersection of two sets.
differenceWith :: Compare o -> s -> s -> s Source #
Difference (relative complement, aka A / B) of two sets.
symdiffWith :: Compare o -> s -> s -> s Source #
Symmetric difference of two sets.
unionWith :: Compare o -> s -> s -> s Source #
Union of two sets.
intersectionsWith :: Foldable f => Compare o -> f s -> s Source #
Fold by intersectionWith.
differencesWith :: Foldable f => Compare o -> f s -> s Source #
Fold by differenceWith.
unionsWith :: Foldable f => Compare o -> f s -> s Source #
Fold by unionWith.
symdiffsWith :: Foldable f => Compare o -> f s -> s Source #
Fold by symdiffWith.
isIntersectsWith :: Compare o -> s -> s -> Bool Source #
Compares sets on intersection.
isDisjointWith :: Compare o -> s -> s -> Bool Source #
Compares sets on disjoint.
memberWith :: Compare o -> o -> s -> Bool Source #
isSubsetWith :: Compare o -> s -> s -> Bool Source #
Сhecks whether a first set is a subset of second.
subsets :: Ord o => s -> [s] Source #
Generates a list of different subsets (including empty and equivalent).
lookupLTWith :: Compare o -> o -> s -> Maybe o Source #
lookupLTWith trying to find lesser element in set.
lookupGTWith :: Compare o -> o -> s -> Maybe o Source #
lookupGTWith trying to find greater element in set.
lookupGEWith :: Compare o -> o -> s -> Maybe o Source #
lookupGEWith trying to find greater or equal element in set.
lookupLEWith :: Compare o -> o -> s -> Maybe o Source #
lookupLEWith trying to find lesser or equal element in set.
Instances
Set
class Nullable s => Set s o | s -> o where Source #
Set is a class of data structures, that can represent any sets. Set is
intended for more specific sets than ordered linear structures. In particular,
it may not work with an arbitrary comparator, and also (unlike the early
implementation) does not impose restrictions on the element type.
Set, as well as SetWith, doesn't provide data protection/validation.
Minimal complete definition
Nothing
Methods
insert :: o -> s -> s Source #
delete :: o -> s -> s Source #
Same as .deleteWith compare
Same as .intersectionWith compare
Same as .differenceWith compare
Same as .symdiffWith compare
(/?\) :: s -> s -> Bool Source #
Same as .isDisjointWith compare
(\?/) :: s -> s -> Bool Source #
Same as .isIntersectsWith compare
(\+/) :: s -> s -> Bool Source #
Same as .isSubsetWith compare
intersections :: Foldable f => f s -> s Source #
Same as .intersectionsWith compare
unions :: Foldable f => f s -> s Source #
Same as .unionsWith compare
differences :: Foldable f => f s -> s Source #
Same as .differencesWith compare
symdiffs :: Foldable f => f s -> s Source #
Same as .symdiffsWith compare'
member :: o -> s -> Bool Source #
Same as .memberWith compare
lookupLT :: Ord o => o -> s -> Maybe o Source #
Same as .lookupLTWith compare
lookupGT :: Ord o => o -> s -> Maybe o Source #
Same as .lookupGTWith compare
lookupLE :: Ord o => o -> s -> Maybe o Source #
Same as .lookupLEWith compare
lookupGE :: Ord o => o -> s -> Maybe o Source #
Same as .lookupGEWith compare