Packages

p

tofu

concurrent

package concurrent

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package impl

Type Members

  1. 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

  2. trait Atom[+F[_], A] extends AnyRef

    a middleground between cats.concurrent.Ref and zio.Ref

  3. sealed trait Exit[+E, +A] extends AnyRef
  4. 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

  5. trait MakeAgentInstances extends AnyRef
  6. trait MakeAtom[I[_], F[_]] extends AnyRef
  7. trait MakeAtomInterop extends AnyRef
  8. trait MakeQVar[I[_], F[_]] extends AnyRef
  9. trait MakeQVarInterop extends AnyRef
  10. 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

  11. trait MakeSerialAgentInstances extends AnyRef
  12. 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
  13. trait QVar[+F[_], A] extends AnyRef

    a middleground between cats.concurrent.MVar and zio.Queue.bounded(1)

  14. 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 of F

Value Members

  1. object Agent
  2. object Atom
  3. object Exit
  4. 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.Agents

    Sample 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 ()
  5. object MakeAtom extends MakeAtomInterop
  6. object MakeQVar extends MakeQVarInterop
  7. 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.SerialAgents

    Sample 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 ()
  8. object QVar
  9. object QVars
  10. object SerialAgent

Deprecated Value Members

  1. object Agents
    Annotations
    @deprecated
    Deprecated

    (Since version 0.10.4) Use Agent.Make

  2. object SerialAgents
    Annotations
    @deprecated
    Deprecated

    (Since version 0.10.4) Use SerialAgent.Make

Ungrouped