polysemy-conc-0.14.1.1: Polysemy effects for concurrency
Safe HaskellNone
LanguageGHC2021

Polysemy.Conc.Effect.Lock

Description

Lock effect, Internal

Synopsis

Documentation

data Lock (a :: Type -> Type) b where Source #

An exclusive lock or mutex, protecting a region from concurrent access.

Constructors

Lock :: forall (a :: Type -> Type) b. a b -> Lock a b

Run an action if the lock is available, block otherwise.

LockOr :: forall (a :: Type -> Type) b. a b -> a b -> Lock a b

Run the second action if the lock is available, or the first action otherwise.

lock :: forall (r :: EffectRow) a. Member Lock r => Sem r a -> Sem r a Source #

Run an action if the lock is available, block otherwise.

lockOr :: forall (r :: EffectRow) a. Member Lock r => Sem r a -> Sem r a -> Sem r a Source #

Run the second action if the lock is available, or the first action otherwise.

lockOrSkip :: forall (r :: EffectRow) a. Member Lock r => Sem r a -> Sem r (Maybe a) Source #

Run an action if the lock is available, skip and return Nothing otherwise.

lockOrSkip_ :: forall (r :: EffectRow) a. Member Lock r => Sem r a -> Sem r () Source #

Run an action if the lock is available, skip otherwise. Return ().