module Control.Concurrent.Chan.Strict
( Chan'
, newChan'
, writeChan'
, readChan'
, dupChan'
, getChan'Contents
, writeList2Chan'
) where
import Control.Exception (evaluate)
import qualified Control.Concurrent.Chan as Base
newtype Chan' a = Chan' (Base.Chan a)
deriving Chan' a -> Chan' a -> Bool
(Chan' a -> Chan' a -> Bool)
-> (Chan' a -> Chan' a -> Bool) -> Eq (Chan' a)
forall a. Chan' a -> Chan' a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Chan' a -> Chan' a -> Bool
== :: Chan' a -> Chan' a -> Bool
$c/= :: forall a. Chan' a -> Chan' a -> Bool
/= :: Chan' a -> Chan' a -> Bool
Eq
newChan' :: IO (Chan' a)
newChan' :: forall a. IO (Chan' a)
newChan' = Chan a -> Chan' a
forall a. Chan a -> Chan' a
Chan' (Chan a -> Chan' a) -> IO (Chan a) -> IO (Chan' a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO (Chan a)
forall a. IO (Chan a)
Base.newChan
writeChan' :: Chan' a -> a -> IO ()
writeChan' :: forall a. Chan' a -> a -> IO ()
writeChan' (Chan' Chan a
chan) a
a = Chan a -> a -> IO ()
forall a. Chan a -> a -> IO ()
Base.writeChan Chan a
chan (a -> IO ()) -> IO a -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< a -> IO a
forall a. a -> IO a
evaluate a
a
readChan' :: Chan' a -> IO a
readChan' :: forall a. Chan' a -> IO a
readChan' (Chan' Chan a
chan) = Chan a -> IO a
forall a. Chan a -> IO a
Base.readChan Chan a
chan
dupChan' :: Chan' a -> IO (Chan' a)
dupChan' :: forall a. Chan' a -> IO (Chan' a)
dupChan' (Chan' Chan a
chan) = Chan a -> Chan' a
forall a. Chan a -> Chan' a
Chan' (Chan a -> Chan' a) -> IO (Chan a) -> IO (Chan' a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Chan a -> IO (Chan a)
forall a. Chan a -> IO (Chan a)
Base.dupChan Chan a
chan
getChan'Contents :: Chan' a -> IO [a]
getChan'Contents :: forall a. Chan' a -> IO [a]
getChan'Contents (Chan' Chan a
chan) = Chan a -> IO [a]
forall a. Chan a -> IO [a]
Base.getChanContents Chan a
chan
writeList2Chan' :: Chan' a -> [a] -> IO ()
writeList2Chan' :: forall a. Chan' a -> [a] -> IO ()
writeList2Chan' = (a -> IO ()) -> [a] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ ((a -> IO ()) -> [a] -> IO ())
-> (Chan' a -> a -> IO ()) -> Chan' a -> [a] -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Chan' a -> a -> IO ()
forall a. Chan' a -> a -> IO ()
writeChan'