vgrep-0.2.2.0: A pager for grep

Safe HaskellSafe
LanguageHaskell2010

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

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

Monad Input 

Methods

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

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

return :: a -> Input a #

fail :: String -> Input a #

Functor Input 

Methods

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

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

Applicative Input 

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 

Methods

empty :: Input a #

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

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

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

MonadPlus Input 

Methods

mzero :: Input a #

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

Monoid (Input a) 

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

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'

Methods

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

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

Divisible Output 

Methods

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

conquer :: Output a #

Decidable Output 

Methods

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

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

Monoid (Output a) 

Methods

mempty :: Output a #

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

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

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

Convert an Input to a Producer

fromInput terminates when the Input is exhausted.

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

Convert an Output to a Consumer

toOutput terminates when the Output is exhausted.