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

Polysemy.Conc.SyncRead

Description

 
Synopsis

Documentation

whileEmpty :: forall a r. Member (SyncRead a) r => Sem r () -> Sem r () Source #

Run an action repeatedly until the SyncRead variable is available.

whileEmptyInterval :: forall a u t d r. TimeUnit u => Members [Time t d, SyncRead a] r => u -> Sem r () -> Sem r () Source #

Run an action repeatedly until the SyncRead variable is available, waiting for the specified time between executions.

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

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

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

Indicate whether the variable is empty.

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.

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

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

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

Read the variable, waiting until a value is available.