Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- data Set a
- empty :: Set a
- singleton :: a -> Set a
- null :: Set a -> Bool
- member :: Ord a => a -> Set a -> Bool
- lookupIndex :: Ord a => a -> Set a -> Maybe Int
- size :: Set a -> Int
- difference :: Ord a => Set a -> Set a -> Set a
- (\\) :: Ord a => Set a -> Set a -> Set a
- intersection :: Ord a => Set a -> Set a -> Set a
- subset :: Ord a => Set a -> Set a -> Bool
- intersects :: Ord a => Set a -> Set a -> Bool
- toArray :: Set a -> Array a
- toList :: Set a -> [a]
- fromList :: Ord a => [a] -> Set a
- foldr :: (a -> b -> b) -> b -> Set a -> b
- foldl' :: (b -> a -> b) -> b -> Set a -> b
- foldr' :: (a -> b -> b) -> b -> Set a -> b
- foldMap' :: Monoid m => (a -> m) -> Set a -> m
- foldMap :: Monoid m => (a -> m) -> Set a -> m
- traverse_ :: Applicative m => (a -> m b) -> Set a -> m ()
- itraverse_ :: Applicative m => (Int -> a -> m b) -> Set a -> m ()

# Documentation

## Instances

Foldable Set Source # | |

Defined in Data.Set.Lifted.Internal fold :: Monoid m => Set m -> m # foldMap :: Monoid m => (a -> m) -> Set a -> m # foldr :: (a -> b -> b) -> b -> Set a -> b # foldr' :: (a -> b -> b) -> b -> Set a -> b # foldl :: (b -> a -> b) -> b -> Set a -> b # foldl' :: (b -> a -> b) -> b -> Set a -> b # foldr1 :: (a -> a -> a) -> Set a -> a # foldl1 :: (a -> a -> a) -> Set a -> a # elem :: Eq a => a -> Set a -> Bool # maximum :: Ord a => Set a -> a # | |

Eq1 Set Source # | |

Show1 Set Source # | |

Hashable1 Set Source # | |

Defined in Data.Set.Lifted.Internal | |

Ord a => IsList (Set a) Source # | |

Eq a => Eq (Set a) Source # | |

Ord a => Ord (Set a) Source # | |

Show a => Show (Set a) Source # | |

Ord a => Semigroup (Set a) Source # | |

Ord a => Monoid (Set a) Source # | |

Hashable a => Hashable (Set a) Source # | |

Defined in Data.Set.Lifted.Internal | |

type Item (Set a) Source # | |

Defined in Data.Set.Lifted.Internal |

lookupIndex :: Ord a => a -> Set a -> Maybe Int Source #

*O(log n)*. Lookup the *index* of an element, which is
its zero-based index in the sorted sequence of elements.

subset :: Ord a => Set a -> Set a -> Bool Source #

Is the first argument a subset of the second argument?

intersects :: Ord a => Set a -> Set a -> Bool Source #

Do the two sets contain any of the same elements?

# Conversion

toArray :: Set a -> Array a Source #

*O(1)* Convert a set to an array. The elements are given in ascending
order. This function is zero-cost.

# Folds

foldr :: (a -> b -> b) -> b -> Set a -> b Source #

Right fold over the elements in the set. This is lazy in the accumulator.

foldMap' :: Monoid m => (a -> m) -> Set a -> m Source #

Strict monoidal fold over the elements in the set.

foldMap :: Monoid m => (a -> m) -> Set a -> m Source #

Lazy monoidal fold over the elements in the set.

# Traversals

traverse_ :: Applicative m => (a -> m b) -> Set a -> m () Source #

Traverse a set, discarding the result.

itraverse_ :: Applicative m => (Int -> a -> m b) -> Set a -> m () Source #

Traverse a set with the indices, discarding the result.