module Control.Concurrent.Chan.Unagi.NoBlocking (
newChan
, InChan(), OutChan()
, tryReadChan
, readChan
, Element(..)
, isActive
, writeChan
, writeList2Chan
, dupChan
, Stream(..), Next(..)
, streamChan
) where
import Control.Concurrent.Chan.Unagi.NoBlocking.Internal hiding (Stream)
import Control.Concurrent.Chan.Unagi.NoBlocking.Types
newChan :: IO (InChan a, OutChan a)
newChan :: IO (InChan a, OutChan a)
newChan = Int -> IO (InChan a, OutChan a)
forall a. Int -> IO (InChan a, OutChan a)
newChanStarting (Int
forall a. Bounded a => a
maxBound Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
10)
writeList2Chan :: InChan a -> [a] -> IO ()
{-# INLINABLE writeList2Chan #-}
writeList2Chan :: InChan a -> [a] -> IO ()
writeList2Chan InChan a
ch = [IO ()] -> IO ()
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, Monad m) =>
t (m a) -> m ()
sequence_ ([IO ()] -> IO ()) -> ([a] -> [IO ()]) -> [a] -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> IO ()) -> [a] -> [IO ()]
forall a b. (a -> b) -> [a] -> [b]
map (InChan a -> a -> IO ()
forall a. InChan a -> a -> IO ()
writeChan InChan a
ch)