rio-0.1.22.0: A standard library for Haskell

Safe Haskell | Safe-Inferred
Language | Haskell2010

RIO.Set

Contents

- Set type
- Operators
- Query
- Construction
- Combine
- Filter
- Indexed
- Map
- Folds
  - Strict folds
- Min/Max
- Conversion
  - List
  - Ordered list
- Debugging

Description

`Set`. Import as:

    import qualified RIO.Set as Set

This module does not export any partial or unchecked functions. For those, see RIO.Set.Partial and RIO.Set.Unchecked

Synopsis

- data Set a
- (\\) :: Ord a => Set a -> Set a -> Set a
- null :: Set a -> Bool
- size :: Set a -> Int
- member :: Ord a => a -> Set a -> Bool
- notMember :: Ord a => a -> Set a -> Bool
- lookupLT :: Ord a => a -> Set a -> Maybe a
- lookupGT :: Ord a => a -> Set a -> Maybe a
- lookupLE :: Ord a => a -> Set a -> Maybe a
- lookupGE :: Ord a => a -> Set a -> Maybe a
- isSubsetOf :: Ord a => Set a -> Set a -> Bool
- isProperSubsetOf :: Ord a => Set a -> Set a -> Bool
- empty :: Set a
- singleton :: a -> Set a
- insert :: Ord a => a -> Set a -> Set a
- delete :: Ord a => a -> Set a -> Set a
- union :: Ord a => Set a -> Set a -> Set a
- unions :: (Foldable f, Ord a) => f (Set a) -> Set a
- difference :: Ord a => Set a -> Set a -> Set a
- intersection :: Ord a => Set a -> Set a -> Set a
- filter :: (a -> Bool) -> Set a -> Set a
- takeWhileAntitone :: (a -> Bool) -> Set a -> Set a
- dropWhileAntitone :: (a -> Bool) -> Set a -> Set a
- spanAntitone :: (a -> Bool) -> Set a -> (Set a, Set a)
- partition :: (a -> Bool) -> Set a -> (Set a, Set a)
- split :: Ord a => a -> Set a -> (Set a, Set a)
- splitMember :: Ord a => a -> Set a -> (Set a, Bool, Set a)
- splitRoot :: Set a -> [Set a]
- lookupIndex :: Ord a => a -> Set a -> Maybe Int
- take :: Int -> Set a -> Set a
- drop :: Int -> Set a -> Set a
- splitAt :: Int -> Set a -> (Set a, Set a)
- map :: Ord b => (a -> b) -> Set a -> Set b
- foldr :: (a -> b -> b) -> b -> Set a -> b
- foldl :: (a -> b -> a) -> a -> Set b -> a
- foldr' :: (a -> b -> b) -> b -> Set a -> b
- foldl' :: (a -> b -> a) -> a -> Set b -> a
- lookupMin :: Set a -> Maybe a
- lookupMax :: Set a -> Maybe a
- deleteMin :: Set a -> Set a
- deleteMax :: Set a -> Set a
- maxView :: Set a -> Maybe (a, Set a)
- minView :: Set a -> Maybe (a, Set a)
- elems :: Set a -> [a]
- toList :: Set a -> [a]
- fromList :: Ord a => [a] -> Set a
- toAscList :: Set a -> [a]
- toDescList :: Set a -> [a]
- showTree :: Show a => Set a -> String
- showTreeWith :: Show a => Bool -> Bool -> Set a -> String
- valid :: Ord a => Set a -> Bool

# Set type

data Set a #

#### Instances

Instances details

Foldable Set |

Instance details

Defined in Data.Set.Internal

Methods

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

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

foldMap' :: Monoid m => (a -> m) -> Set a -> m

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

foldr' :: (a -> b -> b) -> b -> Set a -> b

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

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

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

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

toList :: Set a -> [a] #

null :: Set a -> Bool #

length :: Set a -> Int #

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

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

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

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

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

Eq1 Set |
Instance details Defined in Data.Set.Internal Methods liftEq :: (a -> b -> Bool) -> Set a -> Set b -> Bool
Ord1 Set |
Instance details Defined in Data.Set.Internal Methods liftCompare :: (a -> b -> Ordering) -> Set a -> Set b -> Ordering
Show1 Set |
Instance details Defined in Data.Set.Internal Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Set a -> ShowS liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Set a] -> ShowS
Hashable1 Set | Since: hashable-1.3.4.0
Instance details Defined in Data.Hashable.Class Methods liftHashWithSalt :: (Int -> a -> Int) -> Int -> Set a -> Int #
Lift a => Lift (Set a :: Type) |
Instance details Defined in Data.Set.Internal Methods lift :: Quote m => Set a -> m Exp liftTyped :: forall (m :: Type -> Type). Quote m => Set a -> Code m (Set a)
(Data a, Ord a) => Data (Set a) |

Instance details

Defined in Data.Set.Internal

Methods

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

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

toConstr :: Set a -> Constr #

dataTypeOf :: Set a -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord a => Monoid (Set a) |
Instance details Defined in Data.Set.Internal Methods mempty :: Set a # mappend :: Set a -> Set a -> Set a # mconcat :: [Set a] -> Set a #
Ord a => Semigroup (Set a) |
Instance details Defined in Data.Set.Internal Methods (<>) :: Set a -> Set a -> Set a # sconcat :: NonEmpty (Set a) -> Set a stimes :: Integral b => b -> Set a -> Set a
Ord a => IsList (Set a) |
Instance details Defined in Data.Set.Internal Associated Types type Item (Set a) Methods fromList :: [Item (Set a)] -> Set a fromListN :: Int -> [Item (Set a)] -> Set a toList :: Set a -> [Item (Set a)]
(Read a, Ord a) => Read (Set a) |
Instance details Defined in Data.Set.Internal Methods readsPrec :: Int -> ReadS (Set a) readList :: ReadS [Set a] readPrec :: ReadPrec (Set a) readListPrec :: ReadPrec [Set a]
Show a => Show (Set a) |
Instance details Defined in Data.Set.Internal Methods showsPrec :: Int -> Set a -> ShowS show :: Set a -> String # showList :: [Set a] -> ShowS
NFData a => NFData (Set a) |
Instance details Defined in Data.Set.Internal Methods rnf :: Set a -> () #
Eq a => Eq (Set a) |
Instance details Defined in Data.Set.Internal Methods (==) :: Set a -> Set a -> Bool # (/=) :: Set a -> Set a -> Bool #
Ord a => Ord (Set a) |
Instance details Defined in Data.Set.Internal Methods compare :: Set a -> Set a -> Ordering # (<) :: Set a -> Set a -> Bool # (<=) :: Set a -> Set a -> Bool # (>) :: Set a -> Set a -> Bool # (>=) :: Set a -> Set a -> Bool # max :: Set a -> Set a -> Set a # min :: Set a -> Set a -> Set a #
Hashable v => Hashable (Set v) | Since: hashable-1.3.4.0
Instance details Defined in Data.Hashable.Class Methods hashWithSalt :: Int -> Set v -> Int # hash :: Set v -> Int #
type Item (Set a) |
Instance details Defined in Data.Set.Internal type Item (Set a) = a

# Operators

(\\) :: Ord a => Set a -> Set a -> Set a #

# Query

null :: Set a -> Bool #

size :: Set a -> Int #

member :: Ord a => a -> Set a -> Bool #

notMember :: Ord a => a -> Set a -> Bool #

lookupLT :: Ord a => a -> Set a -> Maybe a #

lookupGT :: Ord a => a -> Set a -> Maybe a #

lookupLE :: Ord a => a -> Set a -> Maybe a #

lookupGE :: Ord a => a -> Set a -> Maybe a #

isSubsetOf :: Ord a => Set a -> Set a -> Bool #

isProperSubsetOf :: Ord a => Set a -> Set a -> Bool #

# Construction

empty :: Set a #

singleton :: a -> Set a #

insert :: Ord a => a -> Set a -> Set a #

delete :: Ord a => a -> Set a -> Set a #

# Combine

union :: Ord a => Set a -> Set a -> Set a #

unions :: (Foldable f, Ord a) => f (Set a) -> Set a #

difference :: Ord a => Set a -> Set a -> Set a #

intersection :: Ord a => Set a -> Set a -> Set a #

# Filter

filter :: (a -> Bool) -> Set a -> Set a #

takeWhileAntitone :: (a -> Bool) -> Set a -> Set a #

dropWhileAntitone :: (a -> Bool) -> Set a -> Set a #

spanAntitone :: (a -> Bool) -> Set a -> (Set a, Set a) #

partition :: (a -> Bool) -> Set a -> (Set a, Set a) #

split :: Ord a => a -> Set a -> (Set a, Set a) #

splitMember :: Ord a => a -> Set a -> (Set a, Bool, Set a) #

splitRoot :: Set a -> [Set a] #

# Indexed

lookupIndex :: Ord a => a -> Set a -> Maybe Int #

take :: Int -> Set a -> Set a #

drop :: Int -> Set a -> Set a #

splitAt :: Int -> Set a -> (Set a, Set a) #

# Map

map :: Ord b => (a -> b) -> Set a -> Set b #

# Folds

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

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

## Strict folds

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

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

# Min/Max

lookupMin :: Set a -> Maybe a #

lookupMax :: Set a -> Maybe a #

deleteMin :: Set a -> Set a #

deleteMax :: Set a -> Set a #

maxView :: Set a -> Maybe (a, Set a) #

minView :: Set a -> Maybe (a, Set a) #

# Conversion

## List

elems :: Set a -> [a] #

toList :: Set a -> [a] #

fromList :: Ord a => [a] -> Set a #

## Ordered list

toAscList :: Set a -> [a] #

toDescList :: Set a -> [a] #

# Debugging

showTree :: Show a => Set a -> String #

showTreeWith :: Show a => Bool -> Bool -> Set a -> String #

valid :: Ord a => Set a -> Bool #