iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Heap.Binary

Documentation

data BinaryHeap (f :: Type -> Type) s a Source #

Constructors

BinaryHeap 

Fields

newBinaryHeap :: (Unbox a, PrimMonad m) => (a -> f a) -> Int -> m (BinaryHeap f (PrimState m) a) Source #

newMinBinaryHeap :: (Unbox a, PrimMonad m) => Int -> m (MinBinaryHeap (PrimState m) a) Source #

newMaxBinaryHeap :: (Unbox a, PrimMonad m) => Int -> m (MaxBinaryHeap (PrimState m) a) Source #

getBinaryHeapSize :: PrimMonad m => BinaryHeap f (PrimState m) a -> m Int Source #

siftUpBy :: (Unbox a, PrimMonad m) => (a -> a -> Ordering) -> Int -> MVector (PrimState m) a -> m () Source #

siftDownBy :: (Unbox a, PrimMonad m) => (a -> a -> Ordering) -> Int -> MVector (PrimState m) a -> m () Source #

heapifyBy :: (Unbox a, PrimMonad m) => (a -> a -> Ordering) -> MVector (PrimState m) a -> m () Source #

class OrdVia f a where Source #

Methods

compareVia :: (a -> f a) -> a -> a -> Ordering Source #

Instances

Instances details
Ord a => OrdVia Identity a Source # 
Instance details

Defined in Data.Heap.Binary

Methods

compareVia :: (a -> Identity a) -> a -> a -> Ordering Source #

Ord a => OrdVia Down a Source # 
Instance details

Defined in Data.Heap.Binary

Methods

compareVia :: (a -> Down a) -> a -> a -> Ordering Source #

buildBinaryHeapVia :: (OrdVia f a, Unbox a, PrimMonad m) => (a -> f a) -> Vector a -> m (BinaryHeap f (PrimState m) a) Source #

buildMinBinaryHeap :: (Ord a, Unbox a, PrimMonad m) => Vector a -> m (BinaryHeap Identity (PrimState m) a) Source #

buildMaxBinaryHeap :: (Ord a, Unbox a, PrimMonad m) => Vector a -> m (BinaryHeap Down (PrimState m) a) Source #

unsafeViewBH :: (Unbox a, PrimMonad m) => BinaryHeap f (PrimState m) a -> m a Source #

viewBH :: (Unbox a, PrimMonad m) => BinaryHeap f (PrimState m) a -> m (Maybe a) Source #

insertBH :: (OrdVia f a, Unbox a, PrimMonad m) => a -> BinaryHeap f (PrimState m) a -> m () Source #

unsafeDeleteBH :: (OrdVia f a, Unbox a, PrimMonad m) => BinaryHeap f (PrimState m) a -> m () Source #

modifyTopBH :: (OrdVia f a, Unbox a, PrimMonad m) => (a -> a) -> BinaryHeap f (PrimState m) a -> m () Source #

deleteFindTopBH :: (OrdVia f a, Unbox a, PrimMonad m) => BinaryHeap f (PrimState m) a -> m (Maybe a) Source #

clearBH :: PrimMonad m => BinaryHeap f (PrimState m) a -> m () Source #

freezeInternalVecBH :: (Unbox a, PrimMonad m) => BinaryHeap f (PrimState m) a -> m (Vector a) Source #