| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Pipes.Concurrent.PQueue
Contents
Description
A variant of Pipes.Concurrent that uses a Finger Tree-based Priority
Queue (TPQueue) instead of a normal TQueue.
Synopsis
- spawn :: Ord p => IO (Output (p, a), Input a, STM ())
- withSpawn :: Ord p => ((Output (p, a), Input a) -> IO r) -> IO r
- newtype Input a = Input {}
- newtype Output a = Output {}
- fromInput :: forall (m :: Type -> Type) a. MonadIO m => Input a -> Producer' a m ()
- toOutput :: forall (m :: Type -> Type) a. MonadIO m => Output a -> Consumer' a m ()
Documentation
withSpawn :: Ord p => ((Output (p, a), Input a) -> IO r) -> IO r Source #
withSpawn passes its enclosed action an Output and Input like you'd
get from spawn, but automatically seals them after the action completes.
This can be used when you need the sealing behavior available from spawn,
but want to work at a bit higher level:
withSpawn buffer $ \(output, input) -> ...
withSpawn is exception-safe, since it uses bracket internally.