polysemy-conc-0.7.0.0: Polysemy Effects for Concurrency
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Conc.Effect.Sync

Description

 
Synopsis

Documentation

data Sync d :: Effect where 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

Constructors

Block :: Sync d m d

Read the variable, waiting until a value is available.

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

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

Try :: Sync d m (Maybe d)

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

TakeBlock :: Sync d m d

Take the variable, waiting until a value is available.

TakeWait :: TimeUnit u => u -> Sync d m (Maybe d)

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

TakeTry :: Sync d m (Maybe d)

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

PutBlock :: d -> Sync d m ()

Write the variable, waiting until it is writable.

PutWait :: TimeUnit u => u -> d -> Sync d m Bool

Write the variable, waiting until it is writable or the timeout has expired.

PutTry :: d -> Sync d m Bool

Write the variable, returning False immmediately if no value was available.

Empty :: Sync d m Bool

Indicate whether the variable is empty.

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 #

Convenience alias.