pqueue-mtl-1.0.7: Fully encapsulated monad transformers with queuelike functionality.Source codeContentsIndex
Control.Monad.Queue.Heap
Description
Safe implementation of an array-backed binary heap. The HeapT transformer requires that the underlying monad provide a MonadST instance, meaning that the bottom-level monad must be ST. This critical restriction protects referential transparency, disallowing multi-threaded behavior as if the '[]' monad were at the bottom level. (The HeapM monad takes care of the ST bottom level automatically.)
Synopsis
type HeapM s e = HeapT e (ST s)
data HeapT e m a
runHeapM :: Ord e => (forall s. HeapM s e a) -> a
runHeapMOn :: Ord e => (forall s. HeapM s e a) -> Int -> [e] -> a
runHeapT :: (MonadST m, Monad m) => HeapT e m a -> m a
runHeapTOn :: (MonadST m, Monad m, Ord e) => HeapT e m a -> Int -> [e] -> m a
data UHeapT e m a
runUHeapT :: (MonadST m, Monad m, UA e, Ord e) => UHeapT e m a -> m a
Documentation
type HeapM s e = HeapT e (ST s)Source
Monad based on an array implementation of a standard binary heap.
data HeapT e m a Source
Monad transformer based on an array implementation of a standard binary heap.
show/hide Instances
runHeapM :: Ord e => (forall s. HeapM s e a) -> aSource
Runs an HeapM computation starting with an empty heap.
runHeapMOn :: Ord e => (forall s. HeapM s e a) -> Int -> [e] -> aSource
runHeapT :: (MonadST m, Monad m) => HeapT e m a -> m aSource
runHeapTOnSource
:: (MonadST m, Monad m, Ord e)
=> HeapT e m aThe transformer operation.
-> IntThe starting size of the heap (must be equal to the length of the list)
-> [e]The initial contents of the heap
-> m a
Runs an HeapM computation starting with a heap initialized to hold the specified list. (Since this can be done with linear preprocessing, this is more efficient than inserting the elements one by one.)
data UHeapT e m a Source
show/hide Instances
MonadReader r m => MonadReader r (UHeapT e m)
MonadWriter w m => MonadWriter w (UHeapT e m)
Monad m => Monad (UHeapT e m)
MonadFix m => MonadFix (UHeapT e m)
(MonadST m, Monad m, UA e, Ord e) => MonadQueue (UHeapT e m)
runUHeapT :: (MonadST m, Monad m, UA e, Ord e) => UHeapT e m a -> m aSource
Produced by Haddock version 2.4.1