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 Source #

Wrapper for `IntSet` with `Enum` elements.

#### Instances

Instances details

FromJSON a => FromJSON (EnumSet a) Source # |
Instance details Defined in Data.EnumSet Methods parseJSON :: Value -> Parser (EnumSet a) Source # parseJSONList :: Value -> Parser [EnumSet a] Source # omittedField :: Maybe (EnumSet a) Source #
ToJSON (EnumSet a) Source # |
Instance details Defined in Data.EnumSet Methods toJSON :: EnumSet a -> Value Source # toEncoding :: EnumSet a -> Encoding Source # toJSONList :: [EnumSet a] -> Value Source # toEncodingList :: [EnumSet a] -> Encoding Source # omitField :: EnumSet a -> Bool Source #
NFData (EnumSet k) Source # |
Instance details Defined in Data.EnumSet Methods rnf :: EnumSet k -> () Source #
Monoid (EnumSet k) Source # |
Instance details Defined in Data.EnumSet Methods mempty :: EnumSet k Source # mappend :: EnumSet k -> EnumSet k -> EnumSet k Source # mconcat :: [EnumSet k] -> EnumSet k Source #
Semigroup (EnumSet k) Source # |
Instance details Defined in Data.EnumSet Methods (<>) :: EnumSet k -> EnumSet k -> EnumSet k Source # sconcat :: NonEmpty (EnumSet k) -> EnumSet k Source # stimes :: Integral b => b -> EnumSet k -> EnumSet k Source #
Enum a => IsList (EnumSet a) Source # |

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 Source #

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

toList :: EnumSet a -> [Item (EnumSet a)] Source #

(Enum k, Read k) => Read (EnumSet k) Source # |
Instance details Defined in Data.EnumSet Methods readsPrec :: Int -> ReadS (EnumSet k) Source # readList :: ReadS [EnumSet k] Source # readPrec :: ReadPrec (EnumSet k) Source # readListPrec :: ReadPrec [EnumSet k] Source #
(Enum k, Show k) => Show (EnumSet k) Source # |
Instance details Defined in Data.EnumSet Methods showsPrec :: Int -> EnumSet k -> ShowS Source # show :: EnumSet k -> String Source # showList :: [EnumSet k] -> ShowS Source #
Eq (EnumSet k) Source # |
Instance details Defined in Data.EnumSet Methods (==) :: EnumSet k -> EnumSet k -> Bool Source # (/=) :: EnumSet k -> EnumSet k -> Bool Source #
Ord (EnumSet k) Source # |
Instance details Defined in Data.EnumSet Methods compare :: EnumSet k -> EnumSet k -> Ordering Source # (<) :: EnumSet k -> EnumSet k -> Bool Source # (<=) :: EnumSet k -> EnumSet k -> Bool Source # (>) :: EnumSet k -> EnumSet k -> Bool Source # (>=) :: EnumSet k -> EnumSet k -> Bool Source # max :: EnumSet k -> EnumSet k -> EnumSet k Source # min :: EnumSet k -> EnumSet k -> EnumSet k Source #
type Item (EnumSet a) Source # |
Instance details Defined in Data.EnumSet type Item (EnumSet a) = a

# Wrapping/unwrapping

intSetToEnumSet :: IntSet -> EnumSet k Source #

Wrap `IntSet`.

enumSetToIntSet :: EnumSet k -> IntSet Source #

Unwrap `IntSet`.

# Operators

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

# Query

null :: EnumSet k -> Bool Source #

size :: EnumSet k -> Int Source #

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

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

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

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

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

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

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

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

# Construction

empty :: EnumSet k Source #

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

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

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

# Combine

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

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

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

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

# Filter

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

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

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

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

# Map

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

# Folds

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

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

## Strict folds

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

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

## Legacy folds

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

# Min/Max

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

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

deleteMin :: EnumSet k -> EnumSet k Source #

deleteMax :: EnumSet k -> EnumSet k Source #

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

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

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

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

# Conversion

## List

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

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

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

## Ordered list

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

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

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

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