Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Fixed-sized array for \(O(1)\) allocation and \(O(1)\) clearing after \(O(N)\) construction.
Synopsis
- data Pool s a = Pool {}
- type PoolIndex = Int
- undefPI :: PoolIndex
- nullPI :: PoolIndex -> Bool
- newPool :: (Unbox a, PrimMonad m) => Int -> m (Pool (PrimState m) a)
- capacityPool :: Unbox a => Pool s a -> Int
- sizePool :: (PrimMonad m, Unbox a) => Pool (PrimState m) a -> m Int
- clearPool :: (PrimMonad m, Unbox a) => Pool (PrimState m) a -> m ()
- allocPool :: (PrimMonad m, Unbox a) => Pool (PrimState m) a -> a -> m PoolIndex
- deallocPool :: (PrimMonad m, Unbox a) => Pool (PrimState m) a -> PoolIndex -> m ()
Documentation
Fixed-sized array for \(O(1)\) allocation.
newPool :: (Unbox a, PrimMonad m) => Int -> m (Pool (PrimState m) a) #
\(O(N)\) Creates a pool with the specified capacity
.
capacityPool :: Unbox a => Pool s a -> Int #
\(O(1)\) Returns the maximum number of elements the pool can store.
sizePool :: (PrimMonad m, Unbox a) => Pool (PrimState m) a -> m Int #
\(O(1)\) Returns the number of elements in the pool.
clearPool :: (PrimMonad m, Unbox a) => Pool (PrimState m) a -> m () #
\(O(1)\) Resets the pool to the initial state.