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

Language | Haskell2010 |

## Synopsis

- data Set a
- empty :: Set a
- singleton :: PrimUnlifted a => a -> Set a
- null :: Set a -> Bool
- member :: (PrimUnlifted a, Ord a) => a -> Set a -> Bool
- size :: PrimUnlifted a => Set a -> Int
- difference :: (PrimUnlifted a, Ord a) => Set a -> Set a -> Set a
- intersection :: (Ord a, PrimUnlifted a) => Set a -> Set a -> Set a
- intersects :: (Ord a, PrimUnlifted a) => Set a -> Set a -> Bool
- subset :: (Ord a, PrimUnlifted a) => Set a -> Set a -> Bool
- enumFromTo :: (Enum a, Ord a, Num a, PrimUnlifted a) => a -> a -> Set a
- toArray :: Set a -> UnliftedArray a
- toList :: PrimUnlifted a => Set a -> [a]
- fromList :: (PrimUnlifted a, Ord a) => [a] -> Set a
- foldr :: PrimUnlifted a => (a -> b -> b) -> b -> Set a -> b
- foldMap :: (PrimUnlifted a, Monoid m) => (a -> m) -> Set a -> m
- foldl' :: PrimUnlifted a => (b -> a -> b) -> b -> Set a -> b
- foldr' :: PrimUnlifted a => (a -> b -> b) -> b -> Set a -> b
- foldMap' :: (PrimUnlifted a, Monoid m) => (a -> m) -> Set a -> m
- traverse_ :: (Applicative m, PrimUnlifted a) => (a -> m b) -> Set a -> m ()
- itraverse_ :: (Applicative m, PrimUnlifted a) => (Int -> a -> m b) -> Set a -> m ()

# Documentation

## Instances

(PrimUnlifted a, Ord a) => IsList (Set a) Source # | The functions that convert a list to a |

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

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

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

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

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

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

Defined in Data.Set.Unlifted.Internal | |

type Item (Set a) Source # | |

Defined in Data.Set.Unlifted.Internal |

singleton :: PrimUnlifted a => a -> Set a Source #

Construct a set with a single element.

difference :: (PrimUnlifted a, Ord a) => Set a -> Set a -> Set a Source #

The difference of two sets.

intersection :: (Ord a, PrimUnlifted a) => Set a -> Set a -> Set a Source #

The intersection of two sets.

intersects :: (Ord a, PrimUnlifted a) => Set a -> Set a -> Bool Source #

Do the two sets contain any of the same elements?

subset :: (Ord a, PrimUnlifted a) => Set a -> Set a -> Bool Source #

Is the first argument a subset of the second argument?

:: (Enum a, Ord a, Num a, PrimUnlifted a) | |

=> a | Inclusive lower bound |

-> a | Inclusive upper bound |

-> Set a |

The set that includes all elements from the lower bound to the upper bound.

# Conversion

toArray :: Set a -> UnliftedArray a Source #

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

toList :: PrimUnlifted a => Set a -> [a] Source #

*O(n)* Convert a set to a list. The elements are given in ascending order.

# Folds

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

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

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

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

foldl' :: PrimUnlifted a => (b -> a -> b) -> b -> Set a -> b Source #

Strict left fold over the elements in the set.

foldr' :: PrimUnlifted a => (a -> b -> b) -> b -> Set a -> b Source #

Strict right fold over the elements in the set.

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

Strict monoidal fold over the elements in the set.

# Traversals

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

Traverse a set, discarding the result.

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

Traverse a set with the indices, discarding the result.