package stm
Ordering
- Alphabetic
Visibility
- Public
- All
Type Members
-
final
class
STM[+E, +A] extends AnyVal
STM[E, A]represents an effect that can be performed transactionally, resulting in a failureEor a valueA.STM[E, A]represents an effect that can be performed transactionally, resulting in a failureEor a valueA.def transfer(receiver: TRef[Int], sender: TRef[Int], much: Int): UIO[Int] = STM.atomically { for { balance <- sender.get _ <- STM.check(balance >= much) _ <- receiver.update(_ + much) _ <- sender.update(_ - much) newAmnt <- receiver.get } yield newAmnt } val action: UIO[Int] = for { t <- STM.atomically(TRef.make(0).zip(TRef.make(20000))) (receiver, sender) = t balance <- transfer(receiver, sender, 1000) } yield balance
- final class TPromise[E, A] extends AnyVal
- class TQueue[A] extends AnyRef
-
class
TRef[A] extends AnyRef
A variable that can be modified as part of a transactional effect.
- class TSemaphore extends AnyRef