iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.BitSet

Synopsis

Documentation

>>> :set -XOverloadedLists

newtype BitSet Source #

Constructors

BitSet 

Fields

Instances

Instances details
Bits BitSet Source # 
Instance details

Defined in Data.BitSet

IsList BitSet Source # 
Instance details

Defined in Data.BitSet

Associated Types

type Item BitSet #

Num BitSet Source # 
Instance details

Defined in Data.BitSet

Show BitSet Source # 
Instance details

Defined in Data.BitSet

Eq BitSet Source # 
Instance details

Defined in Data.BitSet

Methods

(==) :: BitSet -> BitSet -> Bool #

(/=) :: BitSet -> BitSet -> Bool #

Ord BitSet Source # 
Instance details

Defined in Data.BitSet

Unbox BitSet Source # 
Instance details

Defined in Data.BitSet

Vector Vector BitSet Source # 
Instance details

Defined in Data.BitSet

Methods

basicUnsafeFreeze :: Mutable Vector s BitSet -> ST s (Vector BitSet)

basicUnsafeThaw :: Vector BitSet -> ST s (Mutable Vector s BitSet)

basicLength :: Vector BitSet -> Int

basicUnsafeSlice :: Int -> Int -> Vector BitSet -> Vector BitSet

basicUnsafeIndexM :: Vector BitSet -> Int -> Box BitSet

basicUnsafeCopy :: Mutable Vector s BitSet -> Vector BitSet -> ST s ()

elemseq :: Vector BitSet -> BitSet -> b -> b

MVector MVector BitSet Source # 
Instance details

Defined in Data.BitSet

Methods

basicLength :: MVector s BitSet -> Int

basicUnsafeSlice :: Int -> Int -> MVector s BitSet -> MVector s BitSet

basicOverlaps :: MVector s BitSet -> MVector s BitSet -> Bool

basicUnsafeNew :: Int -> ST s (MVector s BitSet)

basicInitialize :: MVector s BitSet -> ST s ()

basicUnsafeReplicate :: Int -> BitSet -> ST s (MVector s BitSet)

basicUnsafeRead :: MVector s BitSet -> Int -> ST s BitSet

basicUnsafeWrite :: MVector s BitSet -> Int -> BitSet -> ST s ()

basicClear :: MVector s BitSet -> ST s ()

basicSet :: MVector s BitSet -> BitSet -> ST s ()

basicUnsafeCopy :: MVector s BitSet -> MVector s BitSet -> ST s ()

basicUnsafeMove :: MVector s BitSet -> MVector s BitSet -> ST s ()

basicUnsafeGrow :: MVector s BitSet -> Int -> ST s (MVector s BitSet)

type Item BitSet Source # 
Instance details

Defined in Data.BitSet

type Item BitSet = Int
newtype Vector BitSet Source # 
Instance details

Defined in Data.BitSet

newtype Vector BitSet = V_BitSet (Vector Int)
newtype MVector s BitSet Source # 
Instance details

Defined in Data.BitSet

newtype MVector s BitSet = MV_BitSet (MVector s Int)

insertBS :: Int -> BitSet -> BitSet Source #

>>> insertBS 0 []
fromList [0]
>>> insertBS 0 [0]
fromList [0]

deleteBS :: Int -> BitSet -> BitSet Source #

>>> deleteBS 2 [1,2,3]
fromList [1,3]
>>> deleteBS 10 [1,2,3]
fromList [1,2,3]
>>> deleteBS 0 []
fromList []

isSubsetOfBS :: BitSet -> BitSet -> Bool Source #

>>> isSubsetOfBS [] [1,2,3]
True
>>> isSubsetOfBS [1] []
False
>>> isSubsetOfBS [1,2,3] [1,2,3]
True

findMinBS :: BitSet -> Int Source #

>>> findMinBS [1,2,3]
1
>>> findMinBS []
64

findMaxBS :: BitSet -> Int Source #

>>> findMaxBS [1,2,3]
3
>>> findMaxBS []
-1

deleteMinBS :: BitSet -> BitSet Source #

>>> deleteMinBS [1,2,3]
fromList [2,3]
>>> deleteMinBS []
fromList []

deleteMaxBS :: BitSet -> BitSet Source #

>>> deleteMaxBS [1,2,3]
fromList [1,2]
>>> deleteMaxBS []
fromList []

powersetBS :: Monad m => BitSet -> Stream m BitSet Source #

>>> import Data.Functor.Identity
>>> runIdentity . MS.toList $ powersetBS [0,1,2]
[fromList [0,1,2],fromList [1,2],fromList [0,2],fromList [2],fromList [0,1],fromList [1],fromList [0],fromList []]
>>> runIdentity . MS.toList $ powersetBS []
[fromList []]

strictPowersetBS :: Monad m => BitSet -> Stream m BitSet Source #

>>> import Data.Functor.Identity
>>> runIdentity . MS.toList $ strictPowersetBS [0,1,2]
[fromList [1,2],fromList [0,2],fromList [2],fromList [0,1],fromList [1],fromList [0],fromList []]
>>> runIdentity . MS.toList $ strictPowersetBS []
[]

toListBS :: BitSet -> [Int] Source #

>>> toListBS [0,1,63]
[0,1,63]
>>> toListBS [0]
[0]
>>> toListBS []
[]

toStreamBS :: Monad m => BitSet -> Stream m Int Source #

>>> import Data.Functor.Identity
>>> runIdentity . MS.toList $ toStreamBS [3,1,4]
[1,3,4]