polysemy-conc-0.13.0.1: Polysemy effects for concurrency
Safe HaskellSafe-Inferred
LanguageGHC2021

Polysemy.Conc.Effect.SyncRead

Description

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

Synopsis

Documentation

data SyncRead (d :: Type) :: Effect where Source #

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

Constructors

Block :: SyncRead d m d

Read the variable, waiting until a value is available.

Wait :: TimeUnit u => u -> SyncRead d m (Maybe d)

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

Try :: SyncRead d m (Maybe d)

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

Empty :: SyncRead d m Bool

Indicate whether the variable is empty.

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

Indicate whether the variable is empty.

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

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

wait :: forall d r 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.

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

Read the variable, waiting until a value is available.