linkedhashmap-0.1.0.0: Persistent LinkedHashMap data structure

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.LinkedHashSet

Contents

Synopsis

Documentation

data LinkedHashSet a Source

A set of values. A set cannot contain duplicate values.

Instances

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

Basic interface

null :: LinkedHashSet a -> Bool Source

O(1) Return True if this set is empty, False otherwise.

size :: LinkedHashSet a -> Int Source

O(1) Return the number of elements in this set.

member :: (Eq a, Hashable a) => a -> LinkedHashSet a -> Bool Source

O(min(n,W)) Return True if the given value is present in this set, False otherwise.

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

Difference and intersection

Folds

Filter

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.