final class IndexedReaderWriterStateT[F[_], E, L, SA, SB, A] extends Serializable

Represents a stateful computation in a context F[_], from state SA to state SB, with an initial environment E, an accumulated log L and a result A.

In other words, it is a pre-baked stack of ReaderT[F, E, A], WriterT[F, L, A] and IndexedStateT[F, SA, SB, A].

Source
IndexedReaderWriterStateT.scala
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. IndexedReaderWriterStateT
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new IndexedReaderWriterStateT(runF: F[(E, SA) ⇒ F[(L, SB, A)]])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def bimap[SC, B](f: (SB) ⇒ SC, g: (A) ⇒ B)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, SA, SC, B]

    Modify the resulting state using f and the resulting value using g.

  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. def contramap[S0](f: (S0) ⇒ SA)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, S0, SB, A]

    Modify the initial state using f.

  8. def dimap[S0, S1](f: (S0) ⇒ SA)(g: (SB) ⇒ S1)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, S0, S1, A]

    Modify the initial state using f and the resulting state using g.

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def flatMap[SC, B](f: (A) ⇒ IndexedReaderWriterStateT[F, E, L, SB, SC, B])(implicit F: FlatMap[F], L: Semigroup[L]): IndexedReaderWriterStateT[F, E, L, SA, SC, B]

    Modify the result of the computation by feeding it into f, threading the state through the resulting computation and combining the log values.

  13. def flatMapF[B](faf: (A) ⇒ F[B])(implicit F: FlatMap[F]): IndexedReaderWriterStateT[F, E, L, SA, SB, B]

    Like map, but allows the mapping function to return an effectful value.

  14. def get(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, SA, SB, SB]

    Get the input state, without modifying it.

  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def inspect[B](f: (SB) ⇒ B)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, SA, SB, B]

    Inspect a value from the input state, without modifying the state.

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def local[EE](f: (EE) ⇒ E)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, EE, L, SA, SB, A]

    Modify the initial environment using f.

    Modify the initial environment using f.

    scala> import cats.implicits._
    scala> type Env = String
    scala> type GlobalEnv = (Int, Env)
    scala> type Log = List[String]
    scala> val xLocal: IndexedReaderWriterStateT[Option, Env, Log, Int, Int, Int] = IndexedReaderWriterStateT.get
    scala> val xGlobal: IndexedReaderWriterStateT[Option, GlobalEnv, Log, Int, Int, Int] = xLocal.local(_._2)
    scala> val globalEnv: GlobalEnv = (5, "env")
    scala> xGlobal.run(globalEnv, 5)
    res0: Option[(List[String], Int, Int)] = Some((List(),5,5))
  20. def map[B](f: (A) ⇒ B)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, SA, SB, B]

    Modify the result of the computation using f.

  21. def mapK[G[_]](f: ~>[F, G])(implicit F: Functor[F]): IndexedReaderWriterStateT[G, E, L, SA, SB, A]

    Modify the context F using transformation f.

  22. def mapWritten[LL](f: (L) ⇒ LL)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, LL, SA, SB, A]

    Modify the written log value using f.

  23. def modify[SC](f: (SB) ⇒ SC)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, SA, SC, A]

    Modify the resulting state.

  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. def reset(implicit F: Functor[F], L: Monoid[L]): IndexedReaderWriterStateT[F, E, L, SA, SB, A]

    Clear the log.

  28. def run(env: E, initial: SA)(implicit F: Monad[F]): F[(L, SB, A)]

    Run the computation using the provided initial environment and state.

  29. def runA(env: E, initial: SA)(implicit F: Monad[F]): F[A]

    Like run, but discards the final state and log.

  30. def runEmpty(env: E)(implicit F: Monad[F], SA: Monoid[SA]): F[(L, SB, A)]

    Run the computation using the provided environment and an empty state.

  31. def runEmptyA(env: E)(implicit F: Monad[F], SA: Monoid[SA]): F[A]

    Like runEmpty, but discards the final state and log.

  32. def runEmptyL(env: E)(implicit F: Monad[F], SA: Monoid[SA]): F[L]

    Like runEmpty, but discards the final state and value.

  33. def runEmptyS(env: E)(implicit F: Monad[F], SA: Monoid[SA]): F[SB]

    Like runEmpty, but discards the final value and log.

  34. val runF: F[(E, SA) ⇒ F[(L, SB, A)]]
  35. def runL(env: E, initial: SA)(implicit F: Monad[F]): F[L]

    Like run, but discards the final state and value.

  36. def runS(env: E, initial: SA)(implicit F: Monad[F]): F[SB]

    Like run, but discards the final value and log.

  37. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  38. def tell(l: L)(implicit F: Functor[F], L: Semigroup[L]): IndexedReaderWriterStateT[F, E, L, SA, SB, A]

    Add a value to the log.

  39. def toString(): String
    Definition Classes
    AnyRef → Any
  40. def transform[LL, SC, B](f: (L, SB, A) ⇒ (LL, SC, B))(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, LL, SA, SC, B]

    Transform the resulting log, state and value using f.

  41. def transformF[G[_], LL, SC, B](f: (F[(L, SB, A)]) ⇒ G[(LL, SC, B)])(implicit F: Monad[F], G: Applicative[G]): IndexedReaderWriterStateT[G, E, LL, SA, SC, B]

    Like transform, but allows the context to change from F to G.

    Like transform, but allows the context to change from F to G.

    scala> import cats.implicits._
    scala> type ErrorOr[A] = Either[String, A]
    scala> type Env = String
    scala> type Log = List[String]
    scala> val xError: IndexedReaderWriterStateT[ErrorOr, Env, Log, Int, Int, Int] = IndexedReaderWriterStateT.get
    scala> val xOpt: IndexedReaderWriterStateT[Option, Env, Log, Int, Int, Int] = xError.transformF(_.toOption)
    scala> val input = 5
    scala> xError.run("env", input)
    res0: ErrorOr[(Log, Int, Int)] = Right((List(),5,5))
    scala> xOpt.run("env", 5)
    res1: Option[(Log, Int, Int)] = Some((List(),5,5))
  42. def transformS[R](f: (R) ⇒ SA, g: (R, SB) ⇒ R)(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, R, R, A]

    Transform the state used.

    Transform the state used. See StateT for more details.

    scala> import cats.implicits._ // needed for StateT.apply
    scala> type Env = String
    scala> type Log = List[String]
    scala> type S[SA, SB, A] = IndexedReaderWriterStateT[Option, Env, Log, SA, SB, A]
    scala> type GlobalEnv = (Int, String)
    scala> val x: S[Int, Int, Double] = IndexedReaderWriterStateT((env: Env, x: Int) => Option(("Addition" :: Nil, x + 1, x.toDouble)))
    scala> val xt: S[GlobalEnv, GlobalEnv, Double] = x.transformS[GlobalEnv](_._1, (t, i) => (i, t._2))
    scala> val input = 5
    scala> x.run("env", input)
    res0: Option[(Log, Int, Double)] = Some((List(Addition),6,5.0))
    scala> xt.run("env", (input, "hello"))
    res1: Option[(Log, GlobalEnv, Double)] = Some((List(Addition),(6,hello),5.0))
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  46. def written(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, SA, SB, L]

    Retrieve the value written to the log.

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped