module UnliftIO.Chan
( Chan
, newChan
, writeChan
, readChan
, dupChan
, getChanContents
, writeList2Chan
) where
import Control.Monad.IO.Unlift
import Control.Concurrent.Chan (Chan)
import qualified Control.Concurrent.Chan as C
newChan :: MonadIO m => m (Chan a)
newChan :: forall (m :: * -> *) a. MonadIO m => m (Chan a)
newChan = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a. IO (Chan a)
C.newChan
writeChan :: MonadIO m => Chan a -> a -> m ()
writeChan :: forall (m :: * -> *) a. MonadIO m => Chan a -> a -> m ()
writeChan Chan a
c = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Chan a -> a -> IO ()
C.writeChan Chan a
c
readChan :: MonadIO m => Chan a -> m a
readChan :: forall (m :: * -> *) a. MonadIO m => Chan a -> m a
readChan = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Chan a -> IO a
C.readChan
dupChan :: MonadIO m => Chan a -> m (Chan a)
dupChan :: forall (m :: * -> *) a. MonadIO m => Chan a -> m (Chan a)
dupChan = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Chan a -> IO (Chan a)
C.dupChan
getChanContents :: MonadIO m => Chan a -> m [a]
getChanContents :: forall (m :: * -> *) a. MonadIO m => Chan a -> m [a]
getChanContents = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Chan a -> IO [a]
C.getChanContents
writeList2Chan :: MonadIO m => Chan a -> [a] -> m ()
writeList2Chan :: forall (m :: * -> *) a. MonadIO m => Chan a -> [a] -> m ()
writeList2Chan Chan a
c = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Chan a -> [a] -> IO ()
C.writeList2Chan Chan a
c