Copyright | Guillaume Sabbagh 2022 |
---|---|
License | LGPL-3.0-or-later |
Maintainer | guillaumesabbagh@protonmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Non-clashing functions for Set
s.
Synopsis
- set :: [a] -> Set a
- setToList :: Eq a => Set a -> [a]
- isIncludedIn :: Eq a => Set a -> Set a -> Bool
- cardinal :: Eq a => Set a -> Int
- isIn :: Eq a => a -> Set a -> Bool
- (|&|) :: Eq a => Set a -> Set a -> Set a
- (|||) :: Set a -> Set a -> Set a
- (|*|) :: Set a -> Set b -> Set (a, b)
- (|+|) :: Set a -> Set b -> Set (Either a b)
- (|-|) :: Eq a => Set a -> Set a -> Set a
- (|^|) :: Eq a => Set a -> Int -> Set [a]
- nubSetBy :: (a -> a -> Bool) -> Set a -> [a]
- anElement :: Set a -> a
- cartesianProductOfSets :: (Monoid (m a), Monad m, Foldable m, Eq a) => m (Set a) -> Set (m a)
Documentation
Set related functions
setToList :: Eq a => Set a -> [a] Source #
O(n^2). Transform a Set
back into a list, the list returned does not have duplicate elements, the order of the original list holds.
isIncludedIn :: Eq a => Set a -> Set a -> Bool Source #
O(n^2). Return a boolean indicating if a Set
is included in another one.
(|^|) :: Eq a => Set a -> Int -> Set [a] Source #
Returns the cartesian product of a set with itself n times.
nubSetBy :: (a -> a -> Bool) -> Set a -> [a] Source #
O(n^2). Remove duplicates in the set using your own equality function.
anElement :: Set a -> a Source #
O(1). Return an element of the set if it is not empty, throw an error otherwise.
cartesianProductOfSets :: (Monoid (m a), Monad m, Foldable m, Eq a) => m (Set a) -> Set (m a) Source #
Return the cartesian product of a collection of sets.