Packages

p

tofu

concurrent

package concurrent

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

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

  6. trait MakeAtom[I[_], F[_]] extends AnyRef
  7. trait MakePermit[I[_], F[_]] extends AnyRef

    A creator of tofu.concurrent.Permit that supports effectful construction

    A creator of tofu.concurrent.Permit that supports effectful construction

    I

    effect for creation of agent

    F

    effect on which agent will run

  8. trait MakeQVar[I[_], F[_]] extends AnyRef
  9. 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

  10. trait Permit[F[_]] extends AnyRef

    A purely functional semaphore.

    A purely functional semaphore. A semaphore has a non-negative number of permits available. Acquiring a permit decrements the current number of permits and releasing a permit increases the current number of permits. An acquire that occurs when there are no permits available results in semantic blocking until a permit becomes available. Blocking withPermit are cancelable.

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

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

  13. trait QVarInstances extends AnyRef
  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 extends AtomInstances
  3. object Exit
  4. object MakeAgent extends MakeAgentInstance

    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 MakeAtomInstance
  6. object MakePermit extends MakePermitInstance

    A helper for creating instances of tofu.concurrent.Permit that use different effects during construction and work.

    A helper for creating instances of tofu.concurrent.Permit that use different effects during construction and work. If you want to use same effect to construct and run Permit use tofu.concurrent.Permit.Make

  7. object MakeQVar extends MakeQVarInstance
  8. object MakeSerialAgent extends MakeSerialAgentInstance

    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 ()
  9. object Permit
  10. object QVar extends QVarInstances
  11. object QVars
  12. 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