-- | Lifted "Control.Concurrent.QSemN".
module Effectful.Concurrent.QSemN
  ( -- * Effect
    Concurrent

    -- ** Handlers
  , runConcurrent

    -- * QSemN
  , QSemN
  , newQSemN
  , waitQSemN
  , signalQSemN
  ) where

import Control.Concurrent.QSemN (QSemN)
import Control.Concurrent.QSemN qualified as Q

import Effectful
import Effectful.Concurrent.Effect
import Effectful.Dispatch.Static

-- | Lifted 'Q.newQSemN'.
newQSemN :: Concurrent :> es => Int -> Eff es QSemN
newQSemN :: forall (es :: [Effect]). (Concurrent :> es) => Int -> Eff es QSemN
newQSemN = IO QSemN -> Eff es QSemN
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO QSemN -> Eff es QSemN)
-> (Int -> IO QSemN) -> Int -> Eff es QSemN
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> IO QSemN
Q.newQSemN

-- | Lifted 'Q.waitQSemN'.
waitQSemN :: Concurrent :> es => QSemN -> Int -> Eff es ()
waitQSemN :: forall (es :: [Effect]).
(Concurrent :> es) =>
QSemN -> Int -> Eff es ()
waitQSemN QSemN
x = IO () -> Eff es ()
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO () -> Eff es ()) -> (Int -> IO ()) -> Int -> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QSemN -> Int -> IO ()
Q.waitQSemN QSemN
x

-- | Lifted 'Q.signalQSemN'.
signalQSemN :: Concurrent :> es => QSemN -> Int -> Eff es ()
signalQSemN :: forall (es :: [Effect]).
(Concurrent :> es) =>
QSemN -> Int -> Eff es ()
signalQSemN QSemN
x = IO () -> Eff es ()
forall a (es :: [Effect]). IO a -> Eff es a
unsafeEff_ (IO () -> Eff es ()) -> (Int -> IO ()) -> Int -> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QSemN -> Int -> IO ()
Q.signalQSemN QSemN
x