module Polysemy.Conc.Interpreter.SyncRead where
import qualified Polysemy.Conc.Effect.Sync as Sync
import Polysemy.Conc.Effect.Sync (Sync)
import qualified Polysemy.Conc.Effect.SyncRead as SyncRead
import Polysemy.Conc.Effect.SyncRead (SyncRead)
syncRead ::
∀ d r .
Member (Sync d) r =>
InterpreterFor (SyncRead d) r
syncRead :: forall d (r :: EffectRow).
Member (Sync d) r =>
InterpreterFor (SyncRead d) r
syncRead =
(forall (rInitial :: EffectRow) x.
SyncRead d (Sem rInitial) x -> Sem r x)
-> Sem (SyncRead d : r) a -> Sem r a
forall (e :: (* -> *) -> * -> *) (r :: EffectRow) a.
FirstOrder e "interpret" =>
(forall (rInitial :: EffectRow) x. e (Sem rInitial) x -> Sem r x)
-> Sem (e : r) a -> Sem r a
interpret \case
SyncRead d (Sem rInitial) x
SyncRead.Block ->
Sem r x
forall d (r :: EffectRow). Member (Sync d) r => Sem r d
Sync.block
SyncRead.Wait u
u ->
u -> Sem r (Maybe d)
forall d (r :: EffectRow) u.
(Member (Sync d) r, TimeUnit u) =>
u -> Sem r (Maybe d)
Sync.wait u
u
SyncRead d (Sem rInitial) x
SyncRead.Try ->
Sem r x
forall d (r :: EffectRow). Member (Sync d) r => Sem r (Maybe d)
Sync.try
SyncRead d (Sem rInitial) x
SyncRead.Empty ->
forall d (r :: EffectRow). Member (Sync d) r => Sem r Bool
Sync.empty @d
{-# inline syncRead #-}