Packages

  • package root
    Definition Classes
    root
  • package tofu
    Definition Classes
    root
  • package concurrent
    Definition Classes
    tofu
  • 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 ()
    Definition Classes
    concurrent
  • Applier

final class Applier[I[_], F[_]] extends AnyVal

Partially-applied creation of Agent for better type inference

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Applier
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Applier(mkAgent: MakeAgent[I, F])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  6. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  7. def of[A](a: A): I[Agent[F, A]]
  8. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped