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

Polysemy.Conc.Data.Sync

Description

 
Synopsis

Documentation

data Sync d :: Effect where Source #

Abstracts an MVar.

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

import Polysemy.Conc (Sync)
import qualified Polysemy.Conc.Data.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.Data.Sync

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