    {-# LANGUAGE DeriveDataTypeable         #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE DeriveAnyClass #-}
    {-# LANGUAGE StandaloneDeriving #-}
    {-# LANGUAGE DerivingStrategies #-}
    {-# LANGUAGE TypeFamilies #-}

    -- |
    -- Module      :  $Header$
    -- Description :  Data.IntSet with Enum 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

    -- This is a simple wrapper for 'Data.IntSet' that allows storing any elements
    -- of Enum type class. Useful if one wants to have the performance of
    -- 'Data.IntSet' and at the same time use something else than 'Int's (e.g. an
    -- 'Int' wrapped with newtype). For documentation see the one for 'Data.IntSet'.

    module Data.EnumSet
      ( EnumSet

      -- * Wrapping/unwrapping
      , intSetToEnumSet
      , enumSetToIntSet

      -- * Operators
      , (\\)

      -- * Query
      , null
      , size
      , member
      , notMember
      , lookupLT
      , lookupGT
      , lookupLE
      , lookupGE
      , isSubsetOf
      , isProperSubsetOf

      -- * Construction
      , empty
      , singleton
      , insert
      , delete

      -- * Combine
      , union
      , unions
      , difference
      , intersection

      -- * Filter
      , filter
      , partition
      , split
      , splitMember

      -- * Map
      , map

      -- * Folds
      , foldr
      , foldl
      -- ** Strict folds
      , foldr'
      , foldl'
      -- ** Legacy folds
      , fold

      -- * Min\/Max
      , findMin
      , findMax
      , deleteMin
      , deleteMax
      , deleteFindMin
      , deleteFindMax
      , maxView
      , minView

      -- * Conversion

      -- ** List
      , elems
      , toList
      , fromList

      -- ** Ordered list
      , toAscList
      , toDescList
      , fromAscList
      , fromDistinctAscList

      ) where

    import Prelude hiding ( Foldable(..), filter, lookup, map )
    import qualified Prelude as P

    import Data.IntSet ( IntSet )
    import qualified Data.IntSet as I

    import Control.Arrow ( (***) )
    import Control.DeepSeq ( NFData )
    import Data.Monoid ( Monoid )
    import Data.Semigroup ( Semigroup )
    import Data.Typeable ( Typeable )
    import Data.Aeson
        ( FromJSON(parseJSON), ToJSON(toEncoding, toJSON) )
    import Text.Read
    import GHC.Generics (Generic)
    import qualified GHC.Exts as IL

    -- | Wrapper for 'IntSet' with 'Enum' elements.
    newtype EnumSet k = EnumSet { forall k. EnumSet k -> IntSet
    unWrap :: IntSet }
      deriving stock
        ( EnumSet k -> EnumSet k -> Bool
    (EnumSet k -> EnumSet k -> Bool)
    -> (EnumSet k -> EnumSet k -> Bool) -> Eq (EnumSet k)
    forall k. EnumSet k -> EnumSet k -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall k. EnumSet k -> EnumSet k -> Bool
    == :: EnumSet k -> EnumSet k -> Bool
    $c/= :: forall k. EnumSet k -> EnumSet k -> Bool
    /= :: EnumSet k -> EnumSet k -> Bool
    Eq
        , Eq (EnumSet k)
    Eq (EnumSet k) =>
    (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)
    -> (EnumSet k -> EnumSet k -> EnumSet k)
    -> (EnumSet k -> EnumSet k -> EnumSet k)
    -> Ord (EnumSet k)
    EnumSet k -> EnumSet k -> Bool
    EnumSet k -> EnumSet k -> Ordering
    EnumSet k -> EnumSet k -> EnumSet k
    forall k. Eq (EnumSet k)
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    forall k. EnumSet k -> EnumSet k -> Bool
    forall k. EnumSet k -> EnumSet k -> Ordering
    forall k. EnumSet k -> EnumSet k -> EnumSet k
    $ccompare :: forall k. EnumSet k -> EnumSet k -> Ordering
    compare :: EnumSet k -> EnumSet k -> Ordering
    $c< :: forall k. EnumSet k -> EnumSet k -> Bool
    < :: EnumSet k -> EnumSet k -> Bool
    $c<= :: forall k. EnumSet k -> EnumSet k -> Bool
    <= :: EnumSet k -> EnumSet k -> Bool
    $c> :: forall k. EnumSet k -> EnumSet k -> Bool
    > :: EnumSet k -> EnumSet k -> Bool
    $c>= :: forall k. EnumSet k -> EnumSet k -> Bool
    >= :: EnumSet k -> EnumSet k -> Bool
    $cmax :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    max :: EnumSet k -> EnumSet k -> EnumSet k
    $cmin :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    min :: EnumSet k -> EnumSet k -> EnumSet k
    Ord
        , Typeable
        )
      deriving newtype
        ( NonEmpty (EnumSet k) -> EnumSet k
    EnumSet k -> EnumSet k -> EnumSet k
    (EnumSet k -> EnumSet k -> EnumSet k)
    -> (NonEmpty (EnumSet k) -> EnumSet k)
    -> (forall b. Integral b => b -> EnumSet k -> EnumSet k)
    -> Semigroup (EnumSet k)
    forall b. Integral b => b -> EnumSet k -> EnumSet k
    forall k. NonEmpty (EnumSet k) -> EnumSet k
    forall k. EnumSet k -> EnumSet k -> EnumSet k
    forall a.
    (a -> a -> a)
    -> (NonEmpty a -> a)
    -> (forall b. Integral b => b -> a -> a)
    -> Semigroup a
    forall k b. Integral b => b -> EnumSet k -> EnumSet k
    $c<> :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    <> :: EnumSet k -> EnumSet k -> EnumSet k
    $csconcat :: forall k. NonEmpty (EnumSet k) -> EnumSet k
    sconcat :: NonEmpty (EnumSet k) -> EnumSet k
    $cstimes :: forall k b. Integral b => b -> EnumSet k -> EnumSet k
    stimes :: forall b. Integral b => b -> EnumSet k -> EnumSet k
    Semigroup
        , Semigroup (EnumSet k)
    EnumSet k
    Semigroup (EnumSet k) =>
    EnumSet k
    -> (EnumSet k -> EnumSet k -> EnumSet k)
    -> ([EnumSet k] -> EnumSet k)
    -> Monoid (EnumSet k)
    [EnumSet k] -> EnumSet k
    EnumSet k -> EnumSet k -> EnumSet k
    forall k. Semigroup (EnumSet k)
    forall k. EnumSet k
    forall a.
    Semigroup a =>
    a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
    forall k. [EnumSet k] -> EnumSet k
    forall k. EnumSet k -> EnumSet k -> EnumSet k
    $cmempty :: forall k. EnumSet k
    mempty :: EnumSet k
    $cmappend :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    mappend :: EnumSet k -> EnumSet k -> EnumSet k
    $cmconcat :: forall k. [EnumSet k] -> EnumSet k
    mconcat :: [EnumSet k] -> EnumSet k
    Monoid
        , EnumSet k -> ()
    (EnumSet k -> ()) -> NFData (EnumSet k)
    forall k. EnumSet k -> ()
    forall a. (a -> ()) -> NFData a
    $crnf :: forall k. EnumSet k -> ()
    rnf :: EnumSet k -> ()
    NFData
        )

    instance (Enum k, Show k) => Show (EnumSet k) where
      showsPrec :: Int -> EnumSet k -> ShowS
    showsPrec Int
    p EnumSet k
    ks = Bool -> ShowS -> ShowS
    showParen (Int
    p Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    10) (ShowS -> ShowS) -> ShowS -> ShowS
    forall a b. (a -> b) -> a -> b
    $
        String -> ShowS
    showString String
    "fromList " ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [k] -> ShowS
    forall a. Show a => a -> ShowS
    shows (EnumSet k -> [k]
    forall k. Enum k => EnumSet k -> [k]
    toList EnumSet k
    ks)

    instance (Enum k, Read k) => Read (EnumSet k) where
      readPrec :: ReadPrec (EnumSet k)
    readPrec = ReadPrec (EnumSet k) -> ReadPrec (EnumSet k)
    forall a. ReadPrec a -> ReadPrec a
    parens (ReadPrec (EnumSet k) -> ReadPrec (EnumSet k))
    -> (ReadPrec (EnumSet k) -> ReadPrec (EnumSet k))
    -> ReadPrec (EnumSet k)
    -> ReadPrec (EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> ReadPrec (EnumSet k) -> ReadPrec (EnumSet k)
    forall a. Int -> ReadPrec a -> ReadPrec a
    prec Int
    10 (ReadPrec (EnumSet k) -> ReadPrec (EnumSet k))
    -> ReadPrec (EnumSet k) -> ReadPrec (EnumSet k)
    forall a b. (a -> b) -> a -> b
    $ do
        Ident "fromList" <- ReadPrec Lexeme
    lexP
        fromList <$> readPrec

    instance ToJSON (EnumSet a) where
        toJSON :: EnumSet a -> Value
    toJSON = IntSet -> Value
    forall a. ToJSON a => a -> Value
    toJSON (IntSet -> Value) -> (EnumSet a -> IntSet) -> EnumSet a -> Value
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet a -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
        toEncoding :: EnumSet a -> Encoding
    toEncoding = IntSet -> Encoding
    forall a. ToJSON a => a -> Encoding
    toEncoding (IntSet -> Encoding)
    -> (EnumSet a -> IntSet) -> EnumSet a -> Encoding
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet a -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap

    instance (FromJSON a) => FromJSON (EnumSet a) where
        parseJSON :: Value -> Parser (EnumSet a)
    parseJSON = ([Int] -> EnumSet a) -> Parser [Int] -> Parser (EnumSet a)
    forall a b. (a -> b) -> Parser a -> Parser b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (IntSet -> EnumSet a
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet a) -> ([Int] -> IntSet) -> [Int] -> EnumSet a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Int] -> IntSet
    I.fromList) (Parser [Int] -> Parser (EnumSet a))
    -> (Value -> Parser [Int]) -> Value -> Parser (EnumSet a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Value -> Parser [Int]
    forall a. FromJSON a => Value -> Parser a
    parseJSON

    instance (Enum a) => IL.IsList (EnumSet a) where
      type Item (EnumSet a) = a

      toList :: EnumSet a -> [Item (EnumSet a)]
    toList = (Int -> a) -> [Int] -> [a]
    forall a b. (a -> b) -> [a] -> [b]
    P.map Int -> a
    forall a. Enum a => Int -> a
    toEnum ([Int] -> [a]) -> (EnumSet a -> [Int]) -> EnumSet a -> [a]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> [Int]
    I.toList (IntSet -> [Int]) -> (EnumSet a -> IntSet) -> EnumSet a -> [Int]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet a -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
      {-# INLINE toList #-}

      fromList :: [Item (EnumSet a)] -> EnumSet a
    fromList = IntSet -> EnumSet a
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet a) -> ([a] -> IntSet) -> [a] -> EnumSet a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Int] -> IntSet
    I.fromList ([Int] -> IntSet) -> ([a] -> [Int]) -> [a] -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (a -> Int) -> [a] -> [Int]
    forall a b. (a -> b) -> [a] -> [b]
    P.map a -> Int
    forall a. Enum a => a -> Int
    fromEnum
      {-# INLINE fromList #-}

    --
    -- Conversion to/from 'IntSet'.
    --

    -- | Wrap 'IntSet'.
    intSetToEnumSet :: IntSet -> EnumSet k
    intSetToEnumSet :: forall k. IntSet -> EnumSet k
    intSetToEnumSet = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet
    {-# INLINE intSetToEnumSet #-}

    -- | Unwrap 'IntSet'.
    enumSetToIntSet :: EnumSet k -> IntSet
    enumSetToIntSet :: forall k. EnumSet k -> IntSet
    enumSetToIntSet = EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE enumSetToIntSet #-}

    --
    -- Here begins the main part.
    --

    (\\) :: EnumSet k -> EnumSet k -> EnumSet k
    (EnumSet IntSet
    is1) \\ :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    \\ (EnumSet IntSet
    is2) = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k) -> IntSet -> EnumSet k
    forall a b. (a -> b) -> a -> b
    $ IntSet
    is1 IntSet -> IntSet -> IntSet
    I.\\ IntSet
    is2
    {-# INLINE (\\) #-}

    null :: EnumSet k -> Bool
    null :: forall a. EnumSet a -> Bool
    null = IntSet -> Bool
    I.null (IntSet -> Bool) -> (EnumSet k -> IntSet) -> EnumSet k -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE null #-}

    size :: EnumSet k -> Int
    size :: forall k. EnumSet k -> Int
    size = IntSet -> Int
    I.size (IntSet -> Int) -> (EnumSet k -> IntSet) -> EnumSet k -> Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE size #-}

    member :: (Enum k) => k -> EnumSet k -> Bool
    member :: forall k. Enum k => k -> EnumSet k -> Bool
    member k
    k = Int -> IntSet -> Bool
    I.member (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> Bool) -> (EnumSet k -> IntSet) -> EnumSet k -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE member #-}

    notMember :: (Enum k) => k -> EnumSet k -> Bool
    notMember :: forall k. Enum k => k -> EnumSet k -> Bool
    notMember k
    k = Int -> IntSet -> Bool
    I.notMember (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> Bool) -> (EnumSet k -> IntSet) -> EnumSet k -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE notMember #-}

    lookupLT :: (Enum k) => k -> EnumSet k -> Maybe k
    lookupLT :: forall k. Enum k => k -> EnumSet k -> Maybe k
    lookupLT k
    k = (Int -> k) -> Maybe Int -> Maybe k
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Int -> k
    forall a. Enum a => Int -> a
    toEnum (Maybe Int -> Maybe k)
    -> (EnumSet k -> Maybe Int) -> EnumSet k -> Maybe k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> Maybe Int
    I.lookupLT (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> Maybe Int)
    -> (EnumSet k -> IntSet) -> EnumSet k -> Maybe Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE lookupLT #-}

    lookupGT :: (Enum k) => k -> EnumSet k -> Maybe k
    lookupGT :: forall k. Enum k => k -> EnumSet k -> Maybe k
    lookupGT k
    k = (Int -> k) -> Maybe Int -> Maybe k
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Int -> k
    forall a. Enum a => Int -> a
    toEnum (Maybe Int -> Maybe k)
    -> (EnumSet k -> Maybe Int) -> EnumSet k -> Maybe k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> Maybe Int
    I.lookupGT (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> Maybe Int)
    -> (EnumSet k -> IntSet) -> EnumSet k -> Maybe Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE lookupGT #-}

    lookupLE :: (Enum k) => k -> EnumSet k -> Maybe k
    lookupLE :: forall k. Enum k => k -> EnumSet k -> Maybe k
    lookupLE k
    k = (Int -> k) -> Maybe Int -> Maybe k
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Int -> k
    forall a. Enum a => Int -> a
    toEnum (Maybe Int -> Maybe k)
    -> (EnumSet k -> Maybe Int) -> EnumSet k -> Maybe k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> Maybe Int
    I.lookupLE (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> Maybe Int)
    -> (EnumSet k -> IntSet) -> EnumSet k -> Maybe Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE lookupLE #-}

    lookupGE :: (Enum k) => k -> EnumSet k -> Maybe k
    lookupGE :: forall k. Enum k => k -> EnumSet k -> Maybe k
    lookupGE k
    k = (Int -> k) -> Maybe Int -> Maybe k
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Int -> k
    forall a. Enum a => Int -> a
    toEnum (Maybe Int -> Maybe k)
    -> (EnumSet k -> Maybe Int) -> EnumSet k -> Maybe k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> Maybe Int
    I.lookupGE (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> Maybe Int)
    -> (EnumSet k -> IntSet) -> EnumSet k -> Maybe Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE lookupGE #-}

    empty :: EnumSet k
    empty :: forall k. EnumSet k
    empty = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet IntSet
    I.empty
    {-# INLINE empty #-}

    singleton :: (Enum k) => k -> EnumSet k
    singleton :: forall k. Enum k => k -> EnumSet k
    singleton = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k) -> (k -> IntSet) -> k -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet
    I.singleton (Int -> IntSet) -> (k -> Int) -> k -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . k -> Int
    forall a. Enum a => a -> Int
    fromEnum
    {-# INLINE singleton #-}

    insert :: (Enum k) => k -> EnumSet k -> EnumSet k
    insert :: forall k. Enum k => k -> EnumSet k -> EnumSet k
    insert k
    k = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (EnumSet k -> IntSet) -> EnumSet k -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> IntSet
    I.insert (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> IntSet) -> (EnumSet k -> IntSet) -> EnumSet k -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE insert #-}

    delete :: (Enum k) => k -> EnumSet k -> EnumSet k
    delete :: forall k. Enum k => k -> EnumSet k -> EnumSet k
    delete k
    k = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (EnumSet k -> IntSet) -> EnumSet k -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> IntSet
    I.delete (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> IntSet) -> (EnumSet k -> IntSet) -> EnumSet k -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE delete #-}

    unions :: [EnumSet k] -> EnumSet k
    unions :: forall k. [EnumSet k] -> EnumSet k
    unions = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> ([EnumSet k] -> IntSet) -> [EnumSet k] -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [IntSet] -> IntSet
    forall (f :: * -> *). Foldable f => f IntSet -> IntSet
    I.unions ([IntSet] -> IntSet)
    -> ([EnumSet k] -> [IntSet]) -> [EnumSet k] -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (EnumSet k -> IntSet) -> [EnumSet k] -> [IntSet]
    forall a b. (a -> b) -> [a] -> [b]
    P.map EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE unions #-}

    union :: EnumSet k -> EnumSet k -> EnumSet k
    union :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    union (EnumSet IntSet
    is1) (EnumSet IntSet
    is2) = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k) -> IntSet -> EnumSet k
    forall a b. (a -> b) -> a -> b
    $ IntSet -> IntSet -> IntSet
    I.union IntSet
    is1 IntSet
    is2
    {-# INLINE union #-}

    difference :: EnumSet k -> EnumSet k -> EnumSet k
    difference :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    difference (EnumSet IntSet
    is1) (EnumSet IntSet
    is2) = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k) -> IntSet -> EnumSet k
    forall a b. (a -> b) -> a -> b
    $ IntSet -> IntSet -> IntSet
    I.difference IntSet
    is1 IntSet
    is2
    {-# INLINE difference #-}

    intersection :: EnumSet k -> EnumSet k -> EnumSet k
    intersection :: forall k. EnumSet k -> EnumSet k -> EnumSet k
    intersection (EnumSet IntSet
    is1) (EnumSet IntSet
    is2) = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k) -> IntSet -> EnumSet k
    forall a b. (a -> b) -> a -> b
    $ IntSet -> IntSet -> IntSet
    I.intersection IntSet
    is1 IntSet
    is2
    {-# INLINE intersection #-}

    isProperSubsetOf :: EnumSet k -> EnumSet k -> Bool
    isProperSubsetOf :: forall k. EnumSet k -> EnumSet k -> Bool
    isProperSubsetOf (EnumSet IntSet
    is1) (EnumSet IntSet
    is2) = IntSet -> IntSet -> Bool
    I.isProperSubsetOf IntSet
    is1 IntSet
    is2
    {-# INLINE isProperSubsetOf #-}

    isSubsetOf :: EnumSet k -> EnumSet k -> Bool
    isSubsetOf :: forall k. EnumSet k -> EnumSet k -> Bool
    isSubsetOf (EnumSet IntSet
    is1) (EnumSet IntSet
    is2) = IntSet -> IntSet -> Bool
    I.isSubsetOf IntSet
    is1 IntSet
    is2
    {-# INLINE isSubsetOf #-}

    filter :: (Enum k) => (k -> Bool) -> EnumSet k -> EnumSet k
    filter :: forall k. Enum k => (k -> Bool) -> EnumSet k -> EnumSet k
    filter k -> Bool
    f = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (EnumSet k -> IntSet) -> EnumSet k -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int -> Bool) -> IntSet -> IntSet
    I.filter (k -> Bool
    f (k -> Bool) -> (Int -> k) -> Int -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) (IntSet -> IntSet) -> (EnumSet k -> IntSet) -> EnumSet k -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE filter #-}

    partition :: (Enum k) => (k -> Bool) -> EnumSet k -> (EnumSet k, EnumSet k)
    partition :: forall k.
    Enum k =>
    (k -> Bool) -> EnumSet k -> (EnumSet k, EnumSet k)
    partition k -> Bool
    f = (IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (IntSet -> EnumSet k)
    -> (IntSet, IntSet)
    -> (EnumSet k, EnumSet k)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet) ((IntSet, IntSet) -> (EnumSet k, EnumSet k))
    -> (EnumSet k -> (IntSet, IntSet))
    -> EnumSet k
    -> (EnumSet k, EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int -> Bool) -> IntSet -> (IntSet, IntSet)
    I.partition (k -> Bool
    f (k -> Bool) -> (Int -> k) -> Int -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) (IntSet -> (IntSet, IntSet))
    -> (EnumSet k -> IntSet) -> EnumSet k -> (IntSet, IntSet)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE partition #-}

    split :: (Enum k) => k -> EnumSet k -> (EnumSet k, EnumSet k)
    split :: forall k. Enum k => k -> EnumSet k -> (EnumSet k, EnumSet k)
    split k
    k = (IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (IntSet -> EnumSet k)
    -> (IntSet, IntSet)
    -> (EnumSet k, EnumSet k)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet) ((IntSet, IntSet) -> (EnumSet k, EnumSet k))
    -> (EnumSet k -> (IntSet, IntSet))
    -> EnumSet k
    -> (EnumSet k, EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> (IntSet, IntSet)
    I.split (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> (IntSet, IntSet))
    -> (EnumSet k -> IntSet) -> EnumSet k -> (IntSet, IntSet)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE split #-}

    splitMember :: (Enum k) => k -> EnumSet k -> (EnumSet k, Bool, EnumSet k)
    splitMember :: forall k. Enum k => k -> EnumSet k -> (EnumSet k, Bool, EnumSet k)
    splitMember k
    k =  (IntSet, Bool, IntSet) -> (EnumSet k, Bool, EnumSet k)
    forall {b} {k} {k}.
    (IntSet, b, IntSet) -> (EnumSet k, b, EnumSet k)
    wrap ((IntSet, Bool, IntSet) -> (EnumSet k, Bool, EnumSet k))
    -> (EnumSet k -> (IntSet, Bool, IntSet))
    -> EnumSet k
    -> (EnumSet k, Bool, EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> IntSet -> (IntSet, Bool, IntSet)
    I.splitMember (k -> Int
    forall a. Enum a => a -> Int
    fromEnum k
    k) (IntSet -> (IntSet, Bool, IntSet))
    -> (EnumSet k -> IntSet) -> EnumSet k -> (IntSet, Bool, IntSet)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
      where
        wrap :: (IntSet, b, IntSet) -> (EnumSet k, b, EnumSet k)
    wrap (IntSet
    is1, b
    b, IntSet
    is2) = (IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet IntSet
    is1, b
    b, IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet IntSet
    is2)
    {-# INLINE splitMember #-}

    maxView :: (Enum k) => EnumSet k -> Maybe (k, EnumSet k)
    maxView :: forall k. Enum k => EnumSet k -> Maybe (k, EnumSet k)
    maxView = ((Int, IntSet) -> (k, EnumSet k))
    -> Maybe (Int, IntSet) -> Maybe (k, EnumSet k)
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Int -> k
    forall a. Enum a => Int -> a
    toEnum (Int -> k)
    -> (IntSet -> EnumSet k) -> (Int, IntSet) -> (k, EnumSet k)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet) (Maybe (Int, IntSet) -> Maybe (k, EnumSet k))
    -> (EnumSet k -> Maybe (Int, IntSet))
    -> EnumSet k
    -> Maybe (k, EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> Maybe (Int, IntSet)
    I.maxView (IntSet -> Maybe (Int, IntSet))
    -> (EnumSet k -> IntSet) -> EnumSet k -> Maybe (Int, IntSet)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE maxView #-}

    minView :: (Enum k) => EnumSet k -> Maybe (k, EnumSet k)
    minView :: forall k. Enum k => EnumSet k -> Maybe (k, EnumSet k)
    minView = ((Int, IntSet) -> (k, EnumSet k))
    -> Maybe (Int, IntSet) -> Maybe (k, EnumSet k)
    forall a b. (a -> b) -> Maybe a -> Maybe b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Int -> k
    forall a. Enum a => Int -> a
    toEnum (Int -> k)
    -> (IntSet -> EnumSet k) -> (Int, IntSet) -> (k, EnumSet k)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet) (Maybe (Int, IntSet) -> Maybe (k, EnumSet k))
    -> (EnumSet k -> Maybe (Int, IntSet))
    -> EnumSet k
    -> Maybe (k, EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> Maybe (Int, IntSet)
    I.minView  (IntSet -> Maybe (Int, IntSet))
    -> (EnumSet k -> IntSet) -> EnumSet k -> Maybe (Int, IntSet)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE minView #-}

    deleteFindMin :: (Enum k) => EnumSet k -> (k, EnumSet k)
    deleteFindMin :: forall k. Enum k => EnumSet k -> (k, EnumSet k)
    deleteFindMin = (Int -> k
    forall a. Enum a => Int -> a
    toEnum (Int -> k)
    -> (IntSet -> EnumSet k) -> (Int, IntSet) -> (k, EnumSet k)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet) ((Int, IntSet) -> (k, EnumSet k))
    -> (EnumSet k -> (Int, IntSet)) -> EnumSet k -> (k, EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> (Int, IntSet)
    I.deleteFindMin (IntSet -> (Int, IntSet))
    -> (EnumSet k -> IntSet) -> EnumSet k -> (Int, IntSet)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE deleteFindMin #-}

    deleteFindMax :: (Enum k) => EnumSet k -> (k, EnumSet k)
    deleteFindMax :: forall k. Enum k => EnumSet k -> (k, EnumSet k)
    deleteFindMax = (Int -> k
    forall a. Enum a => Int -> a
    toEnum (Int -> k)
    -> (IntSet -> EnumSet k) -> (Int, IntSet) -> (k, EnumSet k)
    forall b c b' c'. (b -> c) -> (b' -> c') -> (b, b') -> (c, c')
    forall (a :: * -> * -> *) b c b' c'.
    Arrow a =>
    a b c -> a b' c' -> a (b, b') (c, c')
    *** IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet) ((Int, IntSet) -> (k, EnumSet k))
    -> (EnumSet k -> (Int, IntSet)) -> EnumSet k -> (k, EnumSet k)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> (Int, IntSet)
    I.deleteFindMax (IntSet -> (Int, IntSet))
    -> (EnumSet k -> IntSet) -> EnumSet k -> (Int, IntSet)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE deleteFindMax #-}

    findMin :: (Enum k) => EnumSet k -> k
    findMin :: forall k. Enum k => EnumSet k -> k
    findMin = Int -> k
    forall a. Enum a => Int -> a
    toEnum (Int -> k) -> (EnumSet k -> Int) -> EnumSet k -> k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> Int
    I.findMin (IntSet -> Int) -> (EnumSet k -> IntSet) -> EnumSet k -> Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE findMin #-}

    findMax :: (Enum k) => EnumSet k -> k
    findMax :: forall k. Enum k => EnumSet k -> k
    findMax = Int -> k
    forall a. Enum a => Int -> a
    toEnum (Int -> k) -> (EnumSet k -> Int) -> EnumSet k -> k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> Int
    I.findMax (IntSet -> Int) -> (EnumSet k -> IntSet) -> EnumSet k -> Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE findMax #-}

    deleteMin :: EnumSet k -> EnumSet k
    deleteMin :: forall k. EnumSet k -> EnumSet k
    deleteMin = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (EnumSet k -> IntSet) -> EnumSet k -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> IntSet
    I.deleteMin (IntSet -> IntSet) -> (EnumSet k -> IntSet) -> EnumSet k -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE deleteMin #-}

    deleteMax :: EnumSet k -> EnumSet k
    deleteMax :: forall k. EnumSet k -> EnumSet k
    deleteMax = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (EnumSet k -> IntSet) -> EnumSet k -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> IntSet
    I.deleteMax (IntSet -> IntSet) -> (EnumSet k -> IntSet) -> EnumSet k -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE deleteMax #-}

    map :: (Enum k) => (k -> k) -> EnumSet k -> EnumSet k
    map :: forall k. Enum k => (k -> k) -> EnumSet k -> EnumSet k
    map k -> k
    f = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k)
    -> (EnumSet k -> IntSet) -> EnumSet k -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Int -> Int) -> IntSet -> IntSet
    I.map (k -> Int
    forall a. Enum a => a -> Int
    fromEnum (k -> Int) -> (Int -> k) -> Int -> Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . k -> k
    f (k -> k) -> (Int -> k) -> Int -> k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) (IntSet -> IntSet) -> (EnumSet k -> IntSet) -> EnumSet k -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE map #-}

    foldr :: (Enum k) => (k -> b -> b) -> b -> EnumSet k -> b
    foldr :: forall k b. Enum k => (k -> b -> b) -> b -> EnumSet k -> b
    foldr k -> b -> b
    f b
    acc = (Int -> b -> b) -> b -> IntSet -> b
    forall b. (Int -> b -> b) -> b -> IntSet -> b
    I.foldr (k -> b -> b
    f (k -> b -> b) -> (Int -> k) -> Int -> b -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) b
    acc (IntSet -> b) -> (EnumSet k -> IntSet) -> EnumSet k -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE foldr #-}

    foldl :: (Enum k) => (a -> k -> a) -> a -> EnumSet k -> a
    foldl :: forall k a. Enum k => (a -> k -> a) -> a -> EnumSet k -> a
    foldl a -> k -> a
    f a
    acc = (a -> Int -> a) -> a -> IntSet -> a
    forall a. (a -> Int -> a) -> a -> IntSet -> a
    I.foldl (\a
    a -> a -> k -> a
    f a
    a (k -> a) -> (Int -> k) -> Int -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) a
    acc (IntSet -> a) -> (EnumSet k -> IntSet) -> EnumSet k -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE foldl #-}

    foldr' :: (Enum k) => (k -> b -> b) -> b -> EnumSet k -> b
    foldr' :: forall k b. Enum k => (k -> b -> b) -> b -> EnumSet k -> b
    foldr' k -> b -> b
    f b
    acc = (Int -> b -> b) -> b -> IntSet -> b
    forall b. (Int -> b -> b) -> b -> IntSet -> b
    I.foldr' (k -> b -> b
    f (k -> b -> b) -> (Int -> k) -> Int -> b -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) b
    acc (IntSet -> b) -> (EnumSet k -> IntSet) -> EnumSet k -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE foldr' #-}

    foldl' :: (Enum k) => (a -> k -> a) -> a -> EnumSet k -> a
    foldl' :: forall k a. Enum k => (a -> k -> a) -> a -> EnumSet k -> a
    foldl' a -> k -> a
    f a
    acc = (a -> Int -> a) -> a -> IntSet -> a
    forall a. (a -> Int -> a) -> a -> IntSet -> a
    I.foldl' (\a
    a -> a -> k -> a
    f a
    a (k -> a) -> (Int -> k) -> Int -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) a
    acc (IntSet -> a) -> (EnumSet k -> IntSet) -> EnumSet k -> a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE foldl' #-}

    fold :: (Enum k) => (k -> b -> b) -> b -> EnumSet k -> b
    fold :: forall k b. Enum k => (k -> b -> b) -> b -> EnumSet k -> b
    fold k -> b -> b
    f b
    acc = (Int -> b -> b) -> b -> IntSet -> b
    forall b. (Int -> b -> b) -> b -> IntSet -> b
    I.fold (k -> b -> b
    f (k -> b -> b) -> (Int -> k) -> Int -> b -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> k
    forall a. Enum a => Int -> a
    toEnum) b
    acc (IntSet -> b) -> (EnumSet k -> IntSet) -> EnumSet k -> b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE fold #-}

    elems :: (Enum k) => EnumSet k -> [k]
    elems :: forall k. Enum k => EnumSet k -> [k]
    elems = (Int -> k) -> [Int] -> [k]
    forall a b. (a -> b) -> [a] -> [b]
    P.map Int -> k
    forall a. Enum a => Int -> a
    toEnum ([Int] -> [k]) -> (EnumSet k -> [Int]) -> EnumSet k -> [k]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> [Int]
    I.elems (IntSet -> [Int]) -> (EnumSet k -> IntSet) -> EnumSet k -> [Int]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE elems #-}

    toList :: (Enum k) => EnumSet k -> [k]
    toList :: forall k. Enum k => EnumSet k -> [k]
    toList = EnumSet k -> [k]
    EnumSet k -> [Item (EnumSet k)]
    forall l. IsList l => l -> [Item l]
    IL.toList
    {-# INLINE toList #-}

    toAscList :: (Enum k) => EnumSet k -> [k]
    toAscList :: forall k. Enum k => EnumSet k -> [k]
    toAscList = (Int -> k) -> [Int] -> [k]
    forall a b. (a -> b) -> [a] -> [b]
    P.map Int -> k
    forall a. Enum a => Int -> a
    toEnum ([Int] -> [k]) -> (EnumSet k -> [Int]) -> EnumSet k -> [k]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> [Int]
    I.toAscList (IntSet -> [Int]) -> (EnumSet k -> IntSet) -> EnumSet k -> [Int]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE toAscList #-}

    toDescList :: (Enum k) => EnumSet k -> [k]
    toDescList :: forall k. Enum k => EnumSet k -> [k]
    toDescList = (Int -> k) -> [Int] -> [k]
    forall a b. (a -> b) -> [a] -> [b]
    P.map Int -> k
    forall a. Enum a => Int -> a
    toEnum ([Int] -> [k]) -> (EnumSet k -> [Int]) -> EnumSet k -> [k]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IntSet -> [Int]
    I.toDescList (IntSet -> [Int]) -> (EnumSet k -> IntSet) -> EnumSet k -> [Int]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . EnumSet k -> IntSet
    forall k. EnumSet k -> IntSet
    unWrap
    {-# INLINE toDescList #-}

    fromList :: (Enum k) => [k] -> EnumSet k
    fromList :: forall k. Enum k => [k] -> EnumSet k
    fromList = [k] -> EnumSet k
    [Item (EnumSet k)] -> EnumSet k
    forall l. IsList l => [Item l] -> l
    IL.fromList
    {-# INLINE fromList #-}

    fromAscList :: (Enum k) => [k] -> EnumSet k
    fromAscList :: forall k. Enum k => [k] -> EnumSet k
    fromAscList = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k) -> ([k] -> IntSet) -> [k] -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Int] -> IntSet
    I.fromAscList ([Int] -> IntSet) -> ([k] -> [Int]) -> [k] -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (k -> Int) -> [k] -> [Int]
    forall a b. (a -> b) -> [a] -> [b]
    P.map k -> Int
    forall a. Enum a => a -> Int
    fromEnum
    {-# INLINE fromAscList #-}

    fromDistinctAscList :: (Enum k) => [k] -> EnumSet k
    fromDistinctAscList :: forall k. Enum k => [k] -> EnumSet k
    fromDistinctAscList = IntSet -> EnumSet k
    forall k. IntSet -> EnumSet k
    EnumSet (IntSet -> EnumSet k) -> ([k] -> IntSet) -> [k] -> EnumSet k
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Int] -> IntSet
    I.fromDistinctAscList ([Int] -> IntSet) -> ([k] -> [Int]) -> [k] -> IntSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (k -> Int) -> [k] -> [Int]
    forall a b. (a -> b) -> [a] -> [b]
    P.map k -> Int
    forall a. Enum a => a -> Int
    fromEnum
    {-# INLINE fromDistinctAscList #-}