Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Brick.BChan
Synopsis
- data BChan a
- newBChan :: Int -> IO (BChan a)
- writeBChan :: BChan a -> a -> IO ()
- writeBChanNonBlocking :: BChan a -> a -> IO Bool
- readBChan :: BChan a -> IO a
- readBChan2 :: BChan a -> BChan b -> IO (Either a b)
Documentation
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.
readBChan2 :: BChan a -> BChan b -> IO (Either a b) Source #
Reads the next value from either BChan
, prioritizing the first
BChan
; blocks if necessary.