polysemy-conc-0.3.0.0: Polysemy Effects for Concurrency
Safe HaskellNone
LanguageHaskell2010

Polysemy.Conc.Sync

Description

 
Synopsis

Documentation

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

Run an action repeatedly until the Sync variable is available.

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

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

withSync :: forall d res r. Member (Scoped (SyncResources res) (Sync d)) r => InterpreterFor (Sync d) r Source #

Run an action with a locally scoped Sync variable.

data Sync d :: Effect Source #

Abstracts an MVar.

For documentation on the constructors, see the module Polysemy.Conc.Effect.Sync.

import Polysemy.Conc (Sync)
import qualified Polysemy.Conc.Effect.Sync as Sync

prog :: Member (Sync Int) r => Sem r Int
prog = do
  Sync.putTry 5
  Sync.takeBlock

Instances

Instances details
type DefiningModule Sync Source # 
Instance details

Defined in Polysemy.Conc.Effect.Sync

type DefiningModule Sync = "Polysemy.Conc.Effect.Sync"

type ScopedSync res a = Scoped (SyncResources res) (Sync a) Source #

block :: forall d r. MemberWithError (Sync d) r => Sem r d Source #

wait :: forall d r u. (MemberWithError (Sync d) r, TimeUnit u) => u -> Sem r (Maybe d) Source #

try :: forall d r. MemberWithError (Sync d) r => Sem r (Maybe d) Source #

takeBlock :: forall d r. MemberWithError (Sync d) r => Sem r d Source #

takeWait :: forall d r u. (MemberWithError (Sync d) r, TimeUnit u) => u -> Sem r (Maybe d) Source #

takeTry :: forall d r. MemberWithError (Sync d) r => Sem r (Maybe d) Source #

readBlock :: forall d r. MemberWithError (Sync d) r => Sem r d Source #

readWait :: forall d r u. (MemberWithError (Sync d) r, TimeUnit u) => u -> Sem r (Maybe d) Source #

readTry :: forall d r. MemberWithError (Sync d) r => Sem r (Maybe d) Source #

putBlock :: forall d r. MemberWithError (Sync d) r => d -> Sem r () Source #

putWait :: forall d r u. (MemberWithError (Sync d) r, TimeUnit u) => u -> d -> Sem r Bool Source #

putTry :: forall d r. MemberWithError (Sync d) r => d -> Sem r Bool Source #

empty :: forall d r. MemberWithError (Sync d) r => Sem r Bool Source #