vgrep-0.2.3.0: A pager for grep
Safe HaskellSafe-Inferred
LanguageHaskell2010

Pipes.Concurrent.PQueue

Description

A variant of Pipes.Concurrent that uses a Finger Tree-based Priority Queue (TPQueue) instead of a normal TQueue.

Synopsis

Documentation

spawn :: Ord p => IO (Output (p, a), Input a, STM ()) Source #

Spawn a mailbox to store prioritized messages in a Mailbox. Using recv on the Input will return Just the minimal element, or Nothing if the mailbox is closed.

This function is analogous to Pipes.Concurrent.spawn' Unbounded, but it uses a TPQueue instead of a TQueue to store messages.

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.

Re-exports from Pipes.Concurrent

newtype Input a #

An exhaustible source of values

recv returns Nothing if the source is exhausted

Constructors

Input 

Fields

Instances

Instances details
Monad Input 
Instance details

Defined in Pipes.Concurrent

Methods

(>>=) :: Input a -> (a -> Input b) -> Input b #

(>>) :: Input a -> Input b -> Input b #

return :: a -> Input a #

Functor Input 
Instance details

Defined in Pipes.Concurrent

Methods

fmap :: (a -> b) -> Input a -> Input b #

(<$) :: a -> Input b -> Input a #

Applicative Input 
Instance details

Defined in Pipes.Concurrent

Methods

pure :: a -> Input a #

(<*>) :: Input (a -> b) -> Input a -> Input b #

liftA2 :: (a -> b -> c) -> Input a -> Input b -> Input c #

(*>) :: Input a -> Input b -> Input b #

(<*) :: Input a -> Input b -> Input a #

Alternative Input 
Instance details

Defined in Pipes.Concurrent

Methods

empty :: Input a #

(<|>) :: Input a -> Input a -> Input a #

some :: Input a -> Input [a] #

many :: Input a -> Input [a] #

MonadPlus Input 
Instance details

Defined in Pipes.Concurrent

Methods

mzero :: Input a #

mplus :: Input a -> Input a -> Input a #

Semigroup (Input a) 
Instance details

Defined in Pipes.Concurrent

Methods

(<>) :: Input a -> Input a -> Input a #

sconcat :: NonEmpty (Input a) -> Input a #

stimes :: Integral b => b -> Input a -> Input a #

Monoid (Input a) 
Instance details

Defined in Pipes.Concurrent

Methods

mempty :: Input a #

mappend :: Input a -> Input a -> Input a #

mconcat :: [Input a] -> Input a #

newtype Output a #

An exhaustible sink of values

send returns False if the sink is exhausted

Constructors

Output 

Fields

Instances

Instances details
Contravariant Output

This instance is useful for creating new tagged address, similar to elm's Signal.forwardTo. In fact elm's forwardTo is just 'flip contramap'

Instance details

Defined in Pipes.Concurrent

Methods

contramap :: (a -> b) -> Output b -> Output a #

(>$) :: b -> Output b -> Output a #

Divisible Output 
Instance details

Defined in Pipes.Concurrent

Methods

divide :: (a -> (b, c)) -> Output b -> Output c -> Output a #

conquer :: Output a #

Decidable Output 
Instance details

Defined in Pipes.Concurrent

Methods

lose :: (a -> Void) -> Output a #

choose :: (a -> Either b c) -> Output b -> Output c -> Output a #

Semigroup (Output a) 
Instance details

Defined in Pipes.Concurrent

Methods

(<>) :: Output a -> Output a -> Output a #

sconcat :: NonEmpty (Output a) -> Output a #

stimes :: Integral b => b -> Output a -> Output a #

Monoid (Output a) 
Instance details

Defined in Pipes.Concurrent

Methods

mempty :: Output a #

mappend :: Output a -> Output a -> Output a #

mconcat :: [Output a] -> Output a #

fromInput :: forall (m :: Type -> Type) a. MonadIO m => Input a -> Producer' a m () #

Convert an Input to a Producer

fromInput terminates when the Input is exhausted.

toOutput :: forall (m :: Type -> Type) a. MonadIO m => Output a -> Consumer' a m () #

Convert an Output to a Consumer

toOutput terminates when the Output is exhausted.