module Effectful.Concurrent.Chan.Strict
(
Concurrent
, runConcurrent
, Chan'
, newChan'
, writeChan'
, readChan'
, dupChan'
, getChan'Contents
, writeList2Chan'
) where
import Control.Concurrent.Chan.Strict (Chan')
import Control.Concurrent.Chan.Strict qualified as C
import Effectful
import Effectful.Concurrent.Effect
import Effectful.Dispatch.Static
newChan' :: Concurrent :> es => Eff es (Chan' a)
newChan' :: forall (es :: [Effect]) a. (Concurrent :> es) => Eff es (Chan' a)
newChan' = IO (Chan' a) -> Eff es (Chan' a)
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ IO (Chan' a)
forall a. IO (Chan' a)
C.newChan'
writeChan' :: Concurrent :> es => Chan' a -> a -> Eff es ()
writeChan' :: forall (es :: [Effect]) a.
(Concurrent :> es) =>
Chan' a -> a -> Eff es ()
writeChan' Chan' a
c = IO () -> Eff es ()
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO () -> Eff es ()) -> (a -> IO ()) -> a -> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Chan' a -> a -> IO ()
forall a. Chan' a -> a -> IO ()
C.writeChan' Chan' a
c
readChan' :: Concurrent :> es => Chan' a -> Eff es a
readChan' :: forall (es :: [Effect]) a.
(Concurrent :> es) =>
Chan' a -> Eff es a
readChan' = IO a -> Eff es a
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO a -> Eff es a) -> (Chan' a -> IO a) -> Chan' a -> Eff es a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Chan' a -> IO a
forall a. Chan' a -> IO a
C.readChan'
dupChan' :: Concurrent :> es => Chan' a -> Eff es (Chan' a)
dupChan' :: forall (es :: [Effect]) a.
(Concurrent :> es) =>
Chan' a -> Eff es (Chan' a)
dupChan' = IO (Chan' a) -> Eff es (Chan' a)
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO (Chan' a) -> Eff es (Chan' a))
-> (Chan' a -> IO (Chan' a)) -> Chan' a -> Eff es (Chan' a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Chan' a -> IO (Chan' a)
forall a. Chan' a -> IO (Chan' a)
C.dupChan'
getChan'Contents :: Concurrent :> es => Chan' a -> Eff es [a]
getChan'Contents :: forall (es :: [Effect]) a.
(Concurrent :> es) =>
Chan' a -> Eff es [a]
getChan'Contents = IO [a] -> Eff es [a]
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO [a] -> Eff es [a])
-> (Chan' a -> IO [a]) -> Chan' a -> Eff es [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Chan' a -> IO [a]
forall a. Chan' a -> IO [a]
C.getChan'Contents
writeList2Chan' :: Concurrent :> es => Chan' a -> [a] -> Eff es ()
writeList2Chan' :: forall (es :: [Effect]) a.
(Concurrent :> es) =>
Chan' a -> [a] -> Eff es ()
writeList2Chan' Chan' a
c = IO () -> Eff es ()
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO () -> Eff es ()) -> ([a] -> IO ()) -> [a] -> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Chan' a -> [a] -> IO ()
forall a. Chan' a -> [a] -> IO ()
C.writeList2Chan' Chan' a
c