brick-0.57.1: A declarative terminal user interface library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Brick.BChan

Synopsis

Documentation

data BChan a Source #

BChan is an abstract type representing a bounded FIFO channel.

newBChan Source #

Arguments

:: Int

maximum number of elements the channel can hold

-> IO (BChan a) 

Builds and returns a new instance of BChan.

writeBChan :: BChan a -> a -> IO () Source #

Writes a value to a BChan; blocks if the channel is full.

writeBChanNonBlocking :: BChan a -> a -> IO Bool Source #

Attempts to write a value to a BChan. If the channel has room, the value is written and this returns True. Otherwise this returns False and returns immediately.

readBChan :: BChan a -> IO a Source #

Reads the next value from the BChan; blocks if necessary.

readBChan2 :: BChan a -> BChan b -> IO (Either a b) Source #

Reads the next value from either BChan, prioritizing the first BChan; blocks if necessary.