Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- data LinkedHashSet a
- empty :: LinkedHashSet a
- singleton :: (Eq a, Hashable a) => a -> LinkedHashSet a
- union :: (Eq a, Hashable a) => LinkedHashSet a -> LinkedHashSet a -> LinkedHashSet a
- unions :: (Eq a, Hashable a) => [LinkedHashSet a] -> LinkedHashSet a
- null :: LinkedHashSet a -> Bool
- size :: LinkedHashSet a -> Int
- member :: (Eq a, Hashable a) => a -> LinkedHashSet a -> Bool
- insert :: (Eq a, Hashable a) => a -> LinkedHashSet a -> LinkedHashSet a
- delete :: (Eq a, Hashable a) => a -> LinkedHashSet a -> LinkedHashSet a
- map :: (Hashable b, Eq b) => (a -> b) -> LinkedHashSet a -> LinkedHashSet b
- difference :: (Eq a, Hashable a) => LinkedHashSet a -> LinkedHashSet a -> LinkedHashSet a
- intersection :: (Eq a, Hashable a) => LinkedHashSet a -> LinkedHashSet a -> LinkedHashSet a
- foldl' :: (a -> b -> a) -> a -> LinkedHashSet b -> a
- foldr :: (b -> a -> a) -> a -> LinkedHashSet b -> a
- filter :: (Eq a, Hashable a) => (a -> Bool) -> LinkedHashSet a -> LinkedHashSet a
- toList :: LinkedHashSet a -> [a]
- fromList :: (Eq a, Hashable a) => [a] -> LinkedHashSet a
Documentation
data LinkedHashSet a Source
A set of values. A set cannot contain duplicate values.
Show a => Show (LinkedHashSet a) | |
NFData a => NFData (LinkedHashSet a) |
Construction
empty :: LinkedHashSet a Source
O(1) Construct an empty set.
singleton :: (Eq a, Hashable a) => a -> LinkedHashSet a Source
O(1) Construct a set with a single element.
Combine
union :: (Eq a, Hashable a) => LinkedHashSet a -> LinkedHashSet a -> LinkedHashSet a Source
O(m*log n) Construct a set containing all elements from both sets, n - size of first map.
unions :: (Eq a, Hashable a) => [LinkedHashSet a] -> LinkedHashSet a Source
Construct a set containing all elements from a list of sets.
Basic interface
size :: LinkedHashSet a -> Int Source
O(1) Return the number of elements in this set.
insert :: (Eq a, Hashable a) => a -> LinkedHashSet a -> LinkedHashSet a Source
O(min(n,W)) Add the specified value to this set.
delete :: (Eq a, Hashable a) => a -> LinkedHashSet a -> LinkedHashSet a Source
O(min(n,W)) Remove the specified value from this set if present.
Transformations
map :: (Hashable b, Eq b) => (a -> b) -> LinkedHashSet a -> LinkedHashSet b Source
O(n) Transform this set by applying a function to every value. The resulting set may be smaller than the source.
Difference and intersection
difference :: (Eq a, Hashable a) => LinkedHashSet a -> LinkedHashSet a -> LinkedHashSet a Source
O(n) Difference of two sets. Return elements of the first set not existing in the second.
intersection :: (Eq a, Hashable a) => LinkedHashSet a -> LinkedHashSet a -> LinkedHashSet a Source
O(n) Intersection of two sets. Return elements present in both the first set and the second.
Folds
foldl' :: (a -> b -> a) -> a -> LinkedHashSet b -> a Source
O(n) Reduce this set by applying a binary operator to all elements, using the given starting value (typically the left-identity of the operator). Each application of the operator is evaluated before before using the result in the next application. This function is strict in the starting value.
foldr :: (b -> a -> a) -> a -> LinkedHashSet b -> a Source
O(n) Reduce this set by applying a binary operator to all elements, using the given starting value (typically the right-identity of the operator).
Filter
filter :: (Eq a, Hashable a) => (a -> Bool) -> LinkedHashSet a -> LinkedHashSet a Source
O(n) Filter this set by retaining only elements satisfying a predicate.
Lists
toList :: LinkedHashSet a -> [a] Source
O(n) Return a list of this set's elements. The list is produced lazily.
fromList :: (Eq a, Hashable a) => [a] -> LinkedHashSet a Source
O(n*min(W, n)) Construct a set from a list of elements.