polysemy-conc-0.14.1.1: Polysemy effects for concurrency
Safe HaskellNone
LanguageGHC2021

Polysemy.Conc.Effect.SyncRead

Description

The effect SyncRead is equivalent to Sync without the write actions.

Synopsis

Documentation

data SyncRead d (a :: Type -> Type) b where Source #

An interface to a shared variable (MVar) that can only be read.

Constructors

Block :: forall d (a :: Type -> Type). SyncRead d a d

Read the variable, waiting until a value is available.

Wait :: forall u d (a :: Type -> Type). TimeUnit u => u -> SyncRead d a (Maybe d)

Read the variable, waiting until a value is available or the timeout has expired.

Try :: forall d (a :: Type -> Type). SyncRead d a (Maybe d)

Read the variable, returning Nothing immmediately if no value was available.

Empty :: forall d (a :: Type -> Type). SyncRead d a Bool

Indicate whether the variable is empty.

block :: forall d (r :: EffectRow). Member (SyncRead d) r => Sem r d Source #

Read the variable, waiting until a value is available.

wait :: forall d (r :: EffectRow) u. (Member (SyncRead d) r, TimeUnit u) => u -> Sem r (Maybe d) Source #

Read the variable, waiting until a value is available or the timeout has expired.

try :: forall d (r :: EffectRow). Member (SyncRead d) r => Sem r (Maybe d) Source #

Read the variable, returning Nothing immmediately if no value was available.

empty :: forall d (r :: EffectRow). Member (SyncRead d) r => Sem r Bool Source #

Indicate whether the variable is empty.