package concurrent
- Alphabetic
- Public
- Protected
Type Members
- trait Agent[F[_], A] extends SerialAgent[F, A]
A mutable atomic reference augmented with effectual operations.
A mutable atomic reference augmented with effectual operations. Can be thought as TF version of zio.RefM
- trait Atom[+F[_], A] extends AnyRef
a middleground between cats.concurrent.Ref and zio.Ref
- sealed trait Exit[+E, +A] extends AnyRef
- trait MakeAgent[I[_], F[_]] extends AnyRef
A creator of tofu.concurrent.Agent that supports effectual construction.
A creator of tofu.concurrent.Agent that supports effectual construction.
- I
effect for creation of agent
- F
effect on which agent will be run
- trait MakeAgentInstances extends AnyRef
- trait MakeAtom[I[_], F[_]] extends AnyRef
- trait MakeAtomInterop extends AnyRef
- trait MakeQVar[I[_], F[_]] extends AnyRef
- trait MakeQVarInterop extends AnyRef
- trait MakeSerialAgent[I[_], F[_]] extends AnyRef
A creator of tofu.concurrent.SerialAgent that supports effectful construction
A creator of tofu.concurrent.SerialAgent that supports effectful construction
- I
effect for creation of agent
- F
effect on which agent will run
- trait MakeSerialAgentInstances extends AnyRef
- final case class QAtom[F[_], A](qvar: QVar[F, A])(implicit evidence$1: Applicative[F], evidence$2: Guarantee[F]) extends Atom[F, A] with Product with Serializable
- trait QVar[+F[_], A] extends AnyRef
a middleground between cats.concurrent.MVar and zio.Queue.bounded(1)
- trait SerialAgent[F[_], A] extends AnyRef
A less powerful version of tofu.concurrent.Agent.
A less powerful version of tofu.concurrent.Agent. It does not have the
fireUpdateM
method and thus can be created for greater variety ofF
Value Members
- object Agent
- object Atom
- object Exit
- object MakeAgent extends MakeAgentInstances
A helper for creating instances of tofu.concurrent.Agent that use different effects during construction and work.
A helper for creating instances of tofu.concurrent.Agent that use different effects during construction and work. If you want to use same effect to construct and run
Agent
use tofu.concurrent.AgentsSample usage:
import cats.Monad import cats.implicits._ import cats.syntax.flatMap._ import cats.effect.Sync import tofu.Fire import tofu.concurrent.{Agents, MakeAgent, MakeRef, MakeSemaphore, Refs, Semaphores} import tofu.common.Console def example[F[_]: Agents: Fire: Monad: Console: Sync: Refs: Semaphores]( implicit refs: MakeRef[Option, F], sems: MakeSemaphore[Option, F] ): F[Unit] = for { _ <- Monad[F].unit agent <- MakeAgent[Option, F].of(42).map(Monad[F].pure(_)).getOrElse(Agents[F].of(42)) newValue <- agent.updateM(a => Console[F].putStrLn(s"current value is $a") *> Monad[F].pure(a + 27)) _ <- Console[F].putStrLn(s"new value is $newValue") // new value is 69 } yield ()
- object MakeAtom extends MakeAtomInterop
- object MakeQVar extends MakeQVarInterop
- object MakeSerialAgent extends MakeSerialAgentInstances
A helper for creating instances of tofu.concurrent.SerialAgent that use different effects during construction and work.
A helper for creating instances of tofu.concurrent.SerialAgent that use different effects during construction and work. If you want to use same effect to construct and run
SerialAgent
use tofu.concurrent.SerialAgentsSample usage:
import cats.Monad import cats.implicits._ import cats.syntax.flatMap._ import cats.effect.Sync import tofu.Fire import tofu.concurrent.{SerialAgents, MakeSerialAgent, MakeRef, MakeSemaphore, Refs, Semaphores} import tofu.common.Console def example[F[_]: SerialAgents: Monad: Console: Sync: Refs: Semaphores]( implicit refs: MakeRef[Option, F], sems: MakeSemaphore[Option, F] ): F[Unit] = for { _ <- Monad[F].unit serialAgent <- MakeSerialAgent[Option, F].of(42).map(Monad[F].pure(_)).getOrElse(SerialAgents[F].of(42)) newValue <- serialAgent.updateM(a => Console[F].putStrLn(s"current value is $a") *> Monad[F].pure(a + 27)) _ <- Console[F].putStrLn(s"new value is $newValue") // new value is 69 } yield ()
- object QVar
- object QVars
- object SerialAgent
Deprecated Value Members
- object Agents
- Annotations
- @deprecated
- Deprecated
(Since version 0.10.4) Use Agent.Make
- object SerialAgents
- Annotations
- @deprecated
- Deprecated
(Since version 0.10.4) Use SerialAgent.Make