Data.EnumSet

enummapset-0.7.3.0: IntMap and IntSet with Enum keys/elements.

Copyright | (c) 2011-2019 Michal Terepeta (c) 2019-2022 Mikolaj Konarski and others (see git history)
License | BSD3
Maintainer | mikolaj.konarski@funktory.com
Stability | alpha
Portability | uses DeriveDataTypeable and GeneralizedNewtypeDeriving
Safe Haskell | None
Language | Haskell2010

Data.EnumSet

Contents

- Wrapping/unwrapping
- Operators
- Query
- Construction
- Combine
- Filter
- Map
- Folds
  - Strict folds
  - Legacy folds
- Min/Max
- Conversion
  - List
  - Ordered list

Description

Synopsis

- data EnumSet k
- intSetToEnumSet :: IntSet -> EnumSet k
- enumSetToIntSet :: EnumSet k -> IntSet
- (\\) :: EnumSet k -> EnumSet k -> EnumSet k
- null :: EnumSet k -> Bool
- size :: EnumSet k -> Int
- member :: Enum k => k -> EnumSet k -> Bool
- notMember :: Enum k => k -> EnumSet k -> Bool
- lookupLT :: Enum k => k -> EnumSet k -> Maybe k
- lookupGT :: Enum k => k -> EnumSet k -> Maybe k
- lookupLE :: Enum k => k -> EnumSet k -> Maybe k
- lookupGE :: Enum k => k -> EnumSet k -> Maybe k
- isSubsetOf :: EnumSet k -> EnumSet k -> Bool
- isProperSubsetOf :: EnumSet k -> EnumSet k -> Bool
- empty :: EnumSet k
- singleton :: Enum k => k -> EnumSet k
- insert :: Enum k => k -> EnumSet k -> EnumSet k
- delete :: Enum k => k -> EnumSet k -> EnumSet k
- union :: EnumSet k -> EnumSet k -> EnumSet k
- unions :: [EnumSet k] -> EnumSet k
- difference :: EnumSet k -> EnumSet k -> EnumSet k
- intersection :: EnumSet k -> EnumSet k -> EnumSet k
- filter :: Enum k => (k -> Bool) -> EnumSet k -> EnumSet k
- partition :: Enum k => (k -> Bool) -> EnumSet k -> (EnumSet k, EnumSet k)
- split :: Enum k => k -> EnumSet k -> (EnumSet k, EnumSet k)
- splitMember :: Enum k => k -> EnumSet k -> (EnumSet k, Bool, EnumSet k)
- map :: Enum k => (k -> k) -> EnumSet k -> EnumSet k
- foldr :: Enum k => (k -> b -> b) -> b -> EnumSet k -> b
- foldl :: Enum k => (a -> k -> a) -> a -> EnumSet k -> a
- foldr' :: Enum k => (k -> b -> b) -> b -> EnumSet k -> b
- foldl' :: Enum k => (a -> k -> a) -> a -> EnumSet k -> a
- fold :: Enum k => (k -> b -> b) -> b -> EnumSet k -> b
- findMin :: Enum k => EnumSet k -> k
- findMax :: Enum k => EnumSet k -> k
- deleteMin :: EnumSet k -> EnumSet k
- deleteMax :: EnumSet k -> EnumSet k
- deleteFindMin :: Enum k => EnumSet k -> (k, EnumSet k)
- deleteFindMax :: Enum k => EnumSet k -> (k, EnumSet k)
- maxView :: Enum k => EnumSet k -> Maybe (k, EnumSet k)
- minView :: Enum k => EnumSet k -> Maybe (k, EnumSet k)
- elems :: Enum k => EnumSet k -> [k]
- toList :: Enum k => EnumSet k -> [k]
- fromList :: Enum k => [k] -> EnumSet k
- toAscList :: Enum k => EnumSet k -> [k]
- toDescList :: Enum k => EnumSet k -> [k]
- fromAscList :: Enum k => [k] -> EnumSet k
- fromDistinctAscList :: Enum k => [k] -> EnumSet k

# Documentation

data EnumSet k #

Wrapper for `IntSet` with `Enum` elements.

#### Instances

Instances details

FromJSON a => FromJSON (EnumSet a) # |
Instance details Defined in Data.EnumSet Methods parseJSON :: Value -> Parser (EnumSet a) # parseJSONList :: Value -> Parser [EnumSet a] # omittedField :: Maybe (EnumSet a) #
ToJSON (EnumSet a) # |
Instance details Defined in Data.EnumSet Methods toJSON :: EnumSet a -> Value # toEncoding :: EnumSet a -> Encoding # toJSONList :: [EnumSet a] -> Value # toEncodingList :: [EnumSet a] -> Encoding # omitField :: EnumSet a -> Bool #
NFData (EnumSet k) # |
Instance details Defined in Data.EnumSet Methods rnf :: EnumSet k -> () #
Monoid (EnumSet k) # |
Instance details Defined in Data.EnumSet Methods mempty :: EnumSet k # mappend :: EnumSet k -> EnumSet k -> EnumSet k # mconcat :: [EnumSet k] -> EnumSet k #
Semigroup (EnumSet k) # |
Instance details Defined in Data.EnumSet Methods (<>) :: EnumSet k -> EnumSet k -> EnumSet k # sconcat :: NonEmpty (EnumSet k) -> EnumSet k # stimes :: Integral b => b -> EnumSet k -> EnumSet k #
Enum a => IsList (EnumSet a) # |
Instance details Defined in Data.EnumSet Associated Types
type Item (EnumSet a) |
Instance details Defined in Data.EnumSet type Item (EnumSet a) = a
Methods fromList :: [Item (EnumSet a)] -> EnumSet a # fromListN :: Int -> [Item (EnumSet a)] -> EnumSet a # toList :: EnumSet a -> [Item (EnumSet a)] #
(Enum k, Read k) => Read (EnumSet k) # |
Instance details Defined in Data.EnumSet Methods readsPrec :: Int -> ReadS (EnumSet k) # readList :: ReadS [EnumSet k] # readPrec :: ReadPrec (EnumSet k) # readListPrec :: ReadPrec [EnumSet k] #
(Enum k, Show k) => Show (EnumSet k) # |
Instance details Defined in Data.EnumSet Methods showsPrec :: Int -> EnumSet k -> ShowS # show :: EnumSet k -> String # showList :: [EnumSet k] -> ShowS #
Eq (EnumSet k) # |
Instance details Defined in Data.EnumSet Methods (==) :: EnumSet k -> EnumSet k -> Bool # (/=) :: EnumSet k -> EnumSet k -> Bool #
Ord (EnumSet k) # |
Instance details Defined in Data.EnumSet Methods compare :: EnumSet k -> EnumSet k -> Ordering # (<) :: EnumSet k -> EnumSet k -> Bool # (<=) :: EnumSet k -> EnumSet k -> Bool # (>) :: EnumSet k -> EnumSet k -> Bool # (>=) :: EnumSet k -> EnumSet k -> Bool # max :: EnumSet k -> EnumSet k -> EnumSet k # min :: EnumSet k -> EnumSet k -> EnumSet k #
type Item (EnumSet a) # |
Instance details Defined in Data.EnumSet type Item (EnumSet a) = a

# Wrapping/unwrapping

intSetToEnumSet :: IntSet -> EnumSet k #

Wrap `IntSet`.

enumSetToIntSet :: EnumSet k -> IntSet #

Unwrap `IntSet`.

# Operators

(\\) :: EnumSet k -> EnumSet k -> EnumSet k #

# Query

null :: EnumSet k -> Bool #

size :: EnumSet k -> Int #

member :: Enum k => k -> EnumSet k -> Bool #

notMember :: Enum k => k -> EnumSet k -> Bool #

lookupLT :: Enum k => k -> EnumSet k -> Maybe k #

lookupGT :: Enum k => k -> EnumSet k -> Maybe k #

lookupLE :: Enum k => k -> EnumSet k -> Maybe k #

lookupGE :: Enum k => k -> EnumSet k -> Maybe k #

isSubsetOf :: EnumSet k -> EnumSet k -> Bool #

isProperSubsetOf :: EnumSet k -> EnumSet k -> Bool #

# Construction

empty :: EnumSet k #

singleton :: Enum k => k -> EnumSet k #

insert :: Enum k => k -> EnumSet k -> EnumSet k #

delete :: Enum k => k -> EnumSet k -> EnumSet k #

# Combine

union :: EnumSet k -> EnumSet k -> EnumSet k #

unions :: [EnumSet k] -> EnumSet k #

difference :: EnumSet k -> EnumSet k -> EnumSet k #

intersection :: EnumSet k -> EnumSet k -> EnumSet k #

# Filter

filter :: Enum k => (k -> Bool) -> EnumSet k -> EnumSet k #

partition :: Enum k => (k -> Bool) -> EnumSet k -> (EnumSet k, EnumSet k) #

split :: Enum k => k -> EnumSet k -> (EnumSet k, EnumSet k) #

splitMember :: Enum k => k -> EnumSet k -> (EnumSet k, Bool, EnumSet k) #

# Map

map :: Enum k => (k -> k) -> EnumSet k -> EnumSet k #

# Folds

foldr :: Enum k => (k -> b -> b) -> b -> EnumSet k -> b #

foldl :: Enum k => (a -> k -> a) -> a -> EnumSet k -> a #

## Strict folds

foldr' :: Enum k => (k -> b -> b) -> b -> EnumSet k -> b #

foldl' :: Enum k => (a -> k -> a) -> a -> EnumSet k -> a #

## Legacy folds

fold :: Enum k => (k -> b -> b) -> b -> EnumSet k -> b #

# Min/Max

findMin :: Enum k => EnumSet k -> k #

findMax :: Enum k => EnumSet k -> k #

deleteMin :: EnumSet k -> EnumSet k #

deleteMax :: EnumSet k -> EnumSet k #

deleteFindMin :: Enum k => EnumSet k -> (k, EnumSet k) #

deleteFindMax :: Enum k => EnumSet k -> (k, EnumSet k) #

maxView :: Enum k => EnumSet k -> Maybe (k, EnumSet k) #

minView :: Enum k => EnumSet k -> Maybe (k, EnumSet k) #

# Conversion

## List

elems :: Enum k => EnumSet k -> [k] #

toList :: Enum k => EnumSet k -> [k] #

fromList :: Enum k => [k] -> EnumSet k #

## Ordered list

toAscList :: Enum k => EnumSet k -> [k] #

toDescList :: Enum k => EnumSet k -> [k] #

fromAscList :: Enum k => [k] -> EnumSet k #

fromDistinctAscList :: Enum k => [k] -> EnumSet k #