shimmer-0.1.3.2: The Reflective Lambda Machine
SMR.Data.Bag
Synopsis
data Bag a Source #
An unordered collection of things. O(1) to add a single element, a list of elements, or union two bags.
Constructors
Instances
Methods
showsPrec :: Int -> Bag a -> ShowS #
show :: Bag a -> String #
showList :: [Bag a] -> ShowS #
nil :: Bag a Source #
O(1). Construct an empty bag.
singleton :: a -> Bag a Source #
O(1). Construct a bag containing a single element.
list :: [a] -> Bag a Source #
O(1). Construct a bag containing a list of elements.
union :: Bag a -> Bag a -> Bag a Source #
O(1). Union two bags.
toList :: Bag a -> [a] Source #
O(n). Convert a bag to a list. The elements come out in some deterministic but arbitrary order, no promises.
map :: (a -> b) -> Bag a -> Bag b Source #
Apply a function to all the elements in a bag.