Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data Sync d :: Effect where
- Block :: Sync d m d
- Wait :: TimeUnit u => u -> Sync d m (Maybe d)
- Try :: Sync d m (Maybe d)
- TakeBlock :: Sync d m d
- TakeWait :: TimeUnit u => u -> Sync d m (Maybe d)
- TakeTry :: Sync d m (Maybe d)
- PutBlock :: d -> Sync d m ()
- PutWait :: TimeUnit u => u -> d -> Sync d m Bool
- PutTry :: d -> Sync d m Bool
- Empty :: Sync d m Bool
- empty :: forall d r. Member (Sync d) r => Sem r Bool
- putTry :: forall d r. Member (Sync d) r => d -> Sem r Bool
- putWait :: forall d r u. (Member (Sync d) r, TimeUnit u) => u -> d -> Sem r Bool
- putBlock :: forall d r. Member (Sync d) r => d -> Sem r ()
- takeTry :: forall d r. Member (Sync d) r => Sem r (Maybe d)
- takeWait :: forall d r u. (Member (Sync d) r, TimeUnit u) => u -> Sem r (Maybe d)
- takeBlock :: forall d r. Member (Sync d) r => Sem r d
- try :: forall d r. Member (Sync d) r => Sem r (Maybe d)
- wait :: forall d r u. (Member (Sync d) r, TimeUnit u) => u -> Sem r (Maybe d)
- block :: forall d r. Member (Sync d) r => Sem r d
- type ScopedSync a = Scoped_ (Sync a)
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
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 |
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 |
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 |
Empty :: Sync d m Bool | Indicate whether the variable is empty. |
empty :: forall d r. Member (Sync d) r => Sem r Bool Source #
Indicate whether the variable is empty.
putTry :: forall d r. Member (Sync d) r => d -> Sem r Bool Source #
Write the variable, returning False
immmediately if a value was available.
putWait :: forall d r u. (Member (Sync d) r, TimeUnit u) => u -> d -> Sem r Bool Source #
Write the variable, waiting until it is writable or the timeout has expired.
putBlock :: forall d r. Member (Sync d) r => d -> Sem r () Source #
Write the variable, waiting until it is writable.
takeTry :: forall d r. Member (Sync d) r => Sem r (Maybe d) Source #
Take the variable, returning Nothing
immmediately if no value was available.
takeWait :: forall d r u. (Member (Sync d) r, TimeUnit u) => u -> Sem r (Maybe d) Source #
Take the variable, waiting until a value is available or the timeout has expired.
takeBlock :: forall d r. Member (Sync d) r => Sem r d Source #
Take the variable, waiting until a value is available.
try :: forall d r. Member (Sync d) r => Sem r (Maybe d) Source #
Read the variable, returning Nothing
immmediately if no value was available.
wait :: forall d r u. (Member (Sync 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 (Sync d) r => Sem r d Source #
Read the variable, waiting until a value is available.
type ScopedSync a = Scoped_ (Sync a) Source #
Convenience alias.