| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.IntSet.Bounded.Imperative
Description
An imperative integer set written in Haskell.
See "Making Haskell as fast as C: Imperative programming in Haskell" for a more detailed discussion, https://deliquus.com/posts/2018-07-30-imperative-programming-in-haskell.html.
Synopsis
- data IntSet s
- type IOIntSet = IntSet (PrimState IO)
- intSetMinBound :: IntSet s -> Word64
- intSetMaxBound :: IntSet s -> Word64
- empty :: PrimMonad m => Word64 -> Word64 -> m (IntSet (PrimState m))
- insert :: PrimMonad m => IntSet (PrimState m) -> Word64 -> m ()
- member :: PrimMonad m => IntSet (PrimState m) -> Word64 -> m Bool
- notMember :: PrimMonad m => IntSet (PrimState m) -> Word64 -> m Bool
- delete :: PrimMonad m => IntSet (PrimState m) -> Word64 -> m ()
Types
A strict bounded integer set.
The set is very efficient when accessing elements within the bounds of the set. It uses a regular list to hold numbers outside of this range.
The type parameter s is determined by the monad the data structure
lives in.
intSetMinBound :: IntSet s -> Word64 Source #
Get the minimum efficient bound of the integer set.
intSetMaxBound :: IntSet s -> Word64 Source #
Get the maximum efficient bound of the integer set.
Construction
Arguments
| :: PrimMonad m | |
| => Word64 | Minimum bound of the integer set |
| -> Word64 | Maximum bound of the integer set |
| -> m (IntSet (PrimState m)) |
Construct an empty integer set.
Insertion
insert :: PrimMonad m => IntSet (PrimState m) -> Word64 -> m () Source #
Insert the integer in a set.
Query
member :: PrimMonad m => IntSet (PrimState m) -> Word64 -> m Bool Source #
Is the integer in the set?
notMember :: PrimMonad m => IntSet (PrimState m) -> Word64 -> m Bool Source #
Is the integer not in the set?