sdp4unordered-0.2: SDP classes for unordered containers
Copyright(c) Andrey Mulik 2020
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

SDP.HashSet

Description

SDP.HashSet provides HashSet - unordered set with Hashable keys.

Synopsis

Exports

module SDP.Linear

module SDP.Set

Hash set

data HashSet a #

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

Instances

Instances details
Foldable HashSet 
Instance details

Defined in Data.HashSet.Internal

Methods

fold :: Monoid m => HashSet m -> m #

foldMap :: Monoid m => (a -> m) -> HashSet a -> m #

foldMap' :: Monoid m => (a -> m) -> HashSet a -> m #

foldr :: (a -> b -> b) -> b -> HashSet a -> b #

foldr' :: (a -> b -> b) -> b -> HashSet a -> b #

foldl :: (b -> a -> b) -> b -> HashSet a -> b #

foldl' :: (b -> a -> b) -> b -> HashSet a -> b #

foldr1 :: (a -> a -> a) -> HashSet a -> a #

foldl1 :: (a -> a -> a) -> HashSet a -> a #

toList :: HashSet a -> [a] #

null :: HashSet a -> Bool #

length :: HashSet a -> Int #

elem :: Eq a => a -> HashSet a -> Bool #

maximum :: Ord a => HashSet a -> a #

minimum :: Ord a => HashSet a -> a #

sum :: Num a => HashSet a -> a #

product :: Num a => HashSet a -> a #

Eq1 HashSet 
Instance details

Defined in Data.HashSet.Internal

Methods

liftEq :: (a -> b -> Bool) -> HashSet a -> HashSet b -> Bool #

Ord1 HashSet 
Instance details

Defined in Data.HashSet.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> HashSet a -> HashSet b -> Ordering #

Show1 HashSet 
Instance details

Defined in Data.HashSet.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> HashSet a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [HashSet a] -> ShowS #

Hashable1 HashSet 
Instance details

Defined in Data.HashSet.Internal

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> HashSet a -> Int #

(Eq a, Hashable a) => IsList (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Associated Types

type Item (HashSet a) #

Methods

fromList :: [Item (HashSet a)] -> HashSet a #

fromListN :: Int -> [Item (HashSet a)] -> HashSet a #

toList :: HashSet a -> [Item (HashSet a)] #

Eq a => Eq (HashSet a)

Note that, in the presence of hash collisions, equal HashSets may behave differently, i.e. substitutivity may be violated:

>>> data D = A | B deriving (Eq, Show)
>>> instance Hashable D where hashWithSalt salt _d = salt
>>> x = fromList [A, B]
>>> y = fromList [B, A]
>>> x == y
True
>>> toList x
[A,B]
>>> toList y
[B,A]

In general, the lack of substitutivity can be observed with any function that depends on the key ordering, such as folds and traversals.

Instance details

Defined in Data.HashSet.Internal

Methods

(==) :: HashSet a -> HashSet a -> Bool #

(/=) :: HashSet a -> HashSet a -> Bool #

(Data a, Eq a, Hashable a) => Data (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HashSet a -> c (HashSet a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (HashSet a) #

toConstr :: HashSet a -> Constr #

dataTypeOf :: HashSet a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (HashSet a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (HashSet a)) #

gmapT :: (forall b. Data b => b -> b) -> HashSet a -> HashSet a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HashSet a -> r #

gmapQ :: (forall d. Data d => d -> u) -> HashSet a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> HashSet a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HashSet a -> m (HashSet a) #

Ord a => Ord (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Methods

compare :: HashSet a -> HashSet a -> Ordering #

(<) :: HashSet a -> HashSet a -> Bool #

(<=) :: HashSet a -> HashSet a -> Bool #

(>) :: HashSet a -> HashSet a -> Bool #

(>=) :: HashSet a -> HashSet a -> Bool #

max :: HashSet a -> HashSet a -> HashSet a #

min :: HashSet a -> HashSet a -> HashSet a #

(Eq a, Hashable a, Read a) => Read (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Show a => Show (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Methods

showsPrec :: Int -> HashSet a -> ShowS #

show :: HashSet a -> String #

showList :: [HashSet a] -> ShowS #

(Hashable a, Eq a) => Semigroup (HashSet a)

<> = union

O(n+m)

To obtain good performance, the smaller set must be presented as the first argument.

Examples

Expand
>>> fromList [1,2] <> fromList [2,3]
fromList [1,2,3]
Instance details

Defined in Data.HashSet.Internal

Methods

(<>) :: HashSet a -> HashSet a -> HashSet a #

sconcat :: NonEmpty (HashSet a) -> HashSet a #

stimes :: Integral b => b -> HashSet a -> HashSet a #

(Hashable a, Eq a) => Monoid (HashSet a)

mempty = empty

mappend = union

O(n+m)

To obtain good performance, the smaller set must be presented as the first argument.

Examples

Expand
>>> mappend (fromList [1,2]) (fromList [2,3])
fromList [1,2,3]
Instance details

Defined in Data.HashSet.Internal

Methods

mempty :: HashSet a #

mappend :: HashSet a -> HashSet a -> HashSet a #

mconcat :: [HashSet a] -> HashSet a #

NFData a => NFData (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Methods

rnf :: HashSet a -> () #

Hashable a => Hashable (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

Methods

hashWithSalt :: Int -> HashSet a -> Int #

hash :: HashSet a -> Int #

Nullable (HashSet e) Source # 
Instance details

Defined in SDP.HashSet

Methods

lzero :: HashSet e #

isNull :: HashSet e -> Bool #

Estimate (HashSet e) Source # 
Instance details

Defined in SDP.HashSet

Methods

(<.=>) :: HashSet e -> Int -> Ordering #

(<==>) :: Compare (HashSet e) #

(.==) :: HashSet e -> Int -> Bool #

(./=) :: HashSet e -> Int -> Bool #

(.<=) :: HashSet e -> Int -> Bool #

(.>=) :: HashSet e -> Int -> Bool #

(.<) :: HashSet e -> Int -> Bool #

(.>) :: HashSet e -> Int -> Bool #

(.<.) :: HashSet e -> HashSet e -> Bool #

(.>.) :: HashSet e -> HashSet e -> Bool #

(.<=.) :: HashSet e -> HashSet e -> Bool #

(.>=.) :: HashSet e -> HashSet e -> Bool #

(.==.) :: HashSet e -> HashSet e -> Bool #

(./=.) :: HashSet e -> HashSet e -> Bool #

(Eq e, Hashable e) => Set (HashSet e) e Source # 
Instance details

Defined in SDP.HashSet

Methods

set :: HashSet e -> HashSet e #

insert :: e -> HashSet e -> HashSet e #

delete :: e -> HashSet e -> HashSet e #

(/\) :: HashSet e -> HashSet e -> HashSet e #

(\/) :: HashSet e -> HashSet e -> HashSet e #

(\\) :: HashSet e -> HashSet e -> HashSet e #

(\^/) :: HashSet e -> HashSet e -> HashSet e #

(/?\) :: HashSet e -> HashSet e -> Bool #

(\?/) :: HashSet e -> HashSet e -> Bool #

(\+/) :: HashSet e -> HashSet e -> Bool #

intersections :: Foldable f => f (HashSet e) -> HashSet e #

unions :: Foldable f => f (HashSet e) -> HashSet e #

differences :: Foldable f => f (HashSet e) -> HashSet e #

symdiffs :: Foldable f => f (HashSet e) -> HashSet e #

member :: e -> HashSet e -> Bool #

lookupLT :: e -> HashSet e -> Maybe e #

lookupGT :: e -> HashSet e -> Maybe e #

lookupLE :: e -> HashSet e -> Maybe e #

lookupGE :: e -> HashSet e -> Maybe e #

Bordered (HashSet e) Int Source # 
Instance details

Defined in SDP.HashSet

Methods

bounds :: HashSet e -> (Int, Int) #

lower :: HashSet e -> Int #

upper :: HashSet e -> Int #

sizeOf :: HashSet e -> Int #

sizesOf :: HashSet e -> [Int] #

indexIn :: HashSet e -> Int -> Bool #

indices :: HashSet e -> [Int] #

indexOf :: HashSet e -> Int -> Int #

offsetOf :: HashSet e -> Int -> Int #

type Item (HashSet a) 
Instance details

Defined in Data.HashSet.Internal

type Item (HashSet a) = a

Orphan instances

Nullable (HashSet e) Source # 
Instance details

Methods

lzero :: HashSet e #

isNull :: HashSet e -> Bool #

Estimate (HashSet e) Source # 
Instance details

Methods

(<.=>) :: HashSet e -> Int -> Ordering #

(<==>) :: Compare (HashSet e) #

(.==) :: HashSet e -> Int -> Bool #

(./=) :: HashSet e -> Int -> Bool #

(.<=) :: HashSet e -> Int -> Bool #

(.>=) :: HashSet e -> Int -> Bool #

(.<) :: HashSet e -> Int -> Bool #

(.>) :: HashSet e -> Int -> Bool #

(.<.) :: HashSet e -> HashSet e -> Bool #

(.>.) :: HashSet e -> HashSet e -> Bool #

(.<=.) :: HashSet e -> HashSet e -> Bool #

(.>=.) :: HashSet e -> HashSet e -> Bool #

(.==.) :: HashSet e -> HashSet e -> Bool #

(./=.) :: HashSet e -> HashSet e -> Bool #

(Eq e, Hashable e) => Set (HashSet e) e Source # 
Instance details

Methods

set :: HashSet e -> HashSet e #

insert :: e -> HashSet e -> HashSet e #

delete :: e -> HashSet e -> HashSet e #

(/\) :: HashSet e -> HashSet e -> HashSet e #

(\/) :: HashSet e -> HashSet e -> HashSet e #

(\\) :: HashSet e -> HashSet e -> HashSet e #

(\^/) :: HashSet e -> HashSet e -> HashSet e #

(/?\) :: HashSet e -> HashSet e -> Bool #

(\?/) :: HashSet e -> HashSet e -> Bool #

(\+/) :: HashSet e -> HashSet e -> Bool #

intersections :: Foldable f => f (HashSet e) -> HashSet e #

unions :: Foldable f => f (HashSet e) -> HashSet e #

differences :: Foldable f => f (HashSet e) -> HashSet e #

symdiffs :: Foldable f => f (HashSet e) -> HashSet e #

member :: e -> HashSet e -> Bool #

lookupLT :: e -> HashSet e -> Maybe e #

lookupGT :: e -> HashSet e -> Maybe e #

lookupLE :: e -> HashSet e -> Maybe e #

lookupGE :: e -> HashSet e -> Maybe e #

Bordered (HashSet e) Int Source # 
Instance details

Methods

bounds :: HashSet e -> (Int, Int) #

lower :: HashSet e -> Int #

upper :: HashSet e -> Int #

sizeOf :: HashSet e -> Int #

sizesOf :: HashSet e -> [Int] #

indexIn :: HashSet e -> Int -> Bool #

indices :: HashSet e -> [Int] #

indexOf :: HashSet e -> Int -> Int #

offsetOf :: HashSet e -> Int -> Int #