Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
InsOrdHashSet
is like HashMap
, but it folds in insertion order.
This module interface mimics Data.HashSet, with some additions.
Synopsis
- data InsOrdHashSet k
- empty :: InsOrdHashSet k
- singleton :: Hashable k => k -> InsOrdHashSet k
- null :: InsOrdHashSet k -> Bool
- size :: InsOrdHashSet k -> Int
- member :: (Eq k, Hashable k) => k -> InsOrdHashSet k -> Bool
- insert :: (Eq k, Hashable k) => k -> InsOrdHashSet k -> InsOrdHashSet k
- delete :: (Eq k, Hashable k) => k -> InsOrdHashSet k -> InsOrdHashSet k
- union :: (Eq k, Hashable k) => InsOrdHashSet k -> InsOrdHashSet k -> InsOrdHashSet k
- map :: (Hashable b, Eq b) => (a -> b) -> InsOrdHashSet a -> InsOrdHashSet b
- difference :: (Eq a, Hashable a) => InsOrdHashSet a -> InsOrdHashSet a -> InsOrdHashSet a
- intersection :: (Eq a, Hashable a) => InsOrdHashSet a -> InsOrdHashSet a -> InsOrdHashSet a
- filter :: (a -> Bool) -> InsOrdHashSet a -> InsOrdHashSet a
- toList :: InsOrdHashSet k -> [k]
- fromList :: (Eq k, Hashable k) => [k] -> InsOrdHashSet k
- toHashSet :: InsOrdHashSet k -> HashSet k
- fromHashSet :: HashSet k -> InsOrdHashSet k
- hashSet :: Iso' (InsOrdHashSet a) (HashSet a)
- valid :: InsOrdHashSet a -> Bool
Documentation
data InsOrdHashSet k Source #
HashSet
which tries its best to remember insertion order of elements.
Instances
Construction
empty :: InsOrdHashSet k Source #
singleton :: Hashable k => k -> InsOrdHashSet k Source #
Basic interface
null :: InsOrdHashSet k -> Bool Source #
size :: InsOrdHashSet k -> Int Source #
insert :: (Eq k, Hashable k) => k -> InsOrdHashSet k -> InsOrdHashSet k Source #
delete :: (Eq k, Hashable k) => k -> InsOrdHashSet k -> InsOrdHashSet k Source #
Combine
union :: (Eq k, Hashable k) => InsOrdHashSet k -> InsOrdHashSet k -> InsOrdHashSet k Source #
Transformations
map :: (Hashable b, Eq b) => (a -> b) -> InsOrdHashSet a -> InsOrdHashSet b Source #
Unordered
Difference and intersection
difference :: (Eq a, Hashable a) => InsOrdHashSet a -> InsOrdHashSet a -> InsOrdHashSet a Source #
intersection :: (Eq a, Hashable a) => InsOrdHashSet a -> InsOrdHashSet a -> InsOrdHashSet a Source #
Folds
Unordered
Filter
filter :: (a -> Bool) -> InsOrdHashSet a -> InsOrdHashSet a Source #
Conversions
toList :: InsOrdHashSet k -> [k] Source #
toHashSet :: InsOrdHashSet k -> HashSet k Source #
fromHashSet :: HashSet k -> InsOrdHashSet k Source #
Lenses
hashSet :: Iso' (InsOrdHashSet a) (HashSet a) Source #
This is a slight lie, as roundtrip doesn't preserve ordering.
Debugging
valid :: InsOrdHashSet a -> Bool Source #
Test if the internal map structure is valid.