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

Language | Haskell2010 |

## Synopsis

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

# Documentation

A set of elements.

## Instances

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

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

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

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

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

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

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

Defined in Data.Set.Unboxed.Internal | |

PrimUnlifted (Set a) Source # | |

Defined in Data.Set.Unboxed.Internal type Unlifted (Set a) :: TYPE UnliftedRep # toUnlifted# :: Set a -> Unlifted (Set a) # fromUnlifted# :: Unlifted (Set a) -> Set a # writeUnliftedArray# :: MutableArrayArray# s -> Int# -> Set a -> State# s -> State# s # readUnliftedArray# :: MutableArrayArray# s -> Int# -> State# s -> (#State# s, Set a#) # indexUnliftedArray# :: ArrayArray# -> Int# -> Set a # | |

type Item (Set a) Source # | |

Defined in Data.Set.Unboxed.Internal | |

type Unlifted (Set a) Source # | |

Defined in Data.Set.Unboxed.Internal |

member :: (Prim a, Ord a) => a -> Set a -> Bool Source #

Test whether or not an element is present in a set.

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

Is the first argument a subset of the second argument?

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

Do the two sets contain any of the same elements?

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

# List Conversion

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

Convert a set to a list. The elements are given in ascending order.

toArray :: Set a -> PrimArray a Source #

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

# Folds

foldr :: Prim a => (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, Prim a) => (a -> m) -> Set a -> m Source #

Lazy monoidal fold over the elements in the set.

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

Strict left fold over the elements in the set.

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

Strict right fold over the elements in the set.

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

Strict monoidal fold over the elements in the set.

# Traversals

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

Traverse a set, discarding the result.

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

Traverse a set with the indices, discarding the result.