Packages

  • package root
    Definition Classes
    root
  • package cats

    The cats root package contains all the trait signatures of most Scala type classes.

    The cats root package contains all the trait signatures of most Scala type classes.

    Cats type classes are implemented using the approach from the Type classes as objects and implicits article.

    For each type class, cats provides three pieces: - Its signature: a trait that is polymorphic on a type parameter. Type class traits inherit from other type classes to indicate that any implementation of the lower type class (e.g. Applicative) can also serve as an instance for the higuer type class (e.g. Functor). - Type class 'instances, which are classes and objects that implement one or more type class signatures for some specific types. Type class instances for several data types from the Java or Scala standard libraries are declared in the subpackage cats.instances. - Syntax extensions, each of which provides the methods of the type class defines as extension methods (which in Scala 2 are encoded as implicit classes) for values of any type F; given that an instance of the type class for the receiver type (this) is in the implicit scope. Symtax extensions are declared in the cats.syntax package. - A set of laws, that are also generic on the type of the class, and are only defined on the operations of the type class. The purpose of these laws is to declare some algebraic relations (equations) between Scala expressions involving the operations of the type class, and test (but not verify) that implemented instances satisfy those equations. Laws are defined in the cats-laws package.

    Although most of cats type classes are declared in this package, some are declared in other packages: - type classes that operate on base types (kind *), and their implementations for standard library types, are contained in cats.kernel, which is a different SBT project. However, they are re-exported from this package. - type classes of kind F[_, _], such as cats.arrow.Profunctor" or cats.arrow.Arrow, which are relevant for Functional Reactive Programming or optics, are declared in the cats.arrow package. - Also, those type classes that abstract over (pure or impure) functional runtime effects are declared in the cats-effect library. - Some type classes for which no laws can be provided are left out of the main road, in a small and dirty alley. These are the alleycats.

    Definition Classes
    root
  • package data
    Definition Classes
    cats
  • AndThen
  • AppFunc
  • Binested
  • BinestedBifoldable
  • BinestedBitraverse
  • BinestedInstances
  • Chain
  • Cokleisli
  • Const
  • Cont
  • ContT
  • EitherK
  • EitherT
  • Func
  • IdT
  • IndexedReaderWriterStateT
  • IndexedState
  • IndexedStateT
  • Ior
  • IorT
  • Kleisli
  • Nested
  • NonEmptyChainOps
  • NonEmptyList
  • NonEmptyMapOps
  • NonEmptySetOps
  • NonEmptyVector
  • OneAnd
  • Op
  • OptionT
  • Reader
  • ReaderWriterState
  • ReaderWriterStateT
  • RepresentableStore
  • State
  • StateT
  • Store
  • Tuple2K
  • Validated
  • Writer
  • WriterT
  • ZipList
  • ZipStream
  • ZipVector

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

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[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  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[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. def inspectAsk[B](f: (E, SB) ⇒ B)(implicit F: Monad[F]): IndexedReaderWriterStateT[F, E, L, SA, SB, B]

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

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

    scala> import cats.implicits._
    scala> type Env = String
    scala> type Log = List[String]
    scala> val xOpt: IndexedReaderWriterStateT[Option, Env, Log, Int, Int, Int] = IndexedReaderWriterStateT.get
    scala> val xAsk: IndexedReaderWriterStateT[Option, Env, Log, Int, Int, String] = xOpt.inspectAsk(_ + _)
    scala> val input = 5
    scala> xOpt.run("env", input)
    res0: Option[(Log, Int, Int)] = Some((List(),5,5))
    scala> xAsk.run("env", 5)
    res1: Option[(Log, Int, String)] = Some((List(),5,env5))
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def listen(implicit F: Functor[F]): IndexedReaderWriterStateT[F, E, L, SA, SB, (A, L)]

    Example:

    Example:

    scala> import cats.implicits._
    scala> val x: IndexedReaderWriterStateT[Option, String, String, Int, Int, Unit] = IndexedReaderWriterStateT.tell("something")
    scala> val y: IndexedReaderWriterStateT[Option, String, String, Int, Int, (Unit, String)] = x.listen
    scala> y.run("environment", 17)
    res0: Option[(String, Int, (Unit, String))] = Some((something,17,((),something)))
  21. 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))
  22. 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.

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

    Modify the context F using transformation f.

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

    Modify the written log value using f.

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

    Modify the resulting state.

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

    Clear the log.

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

    Run the computation using the provided initial environment and state.

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

    Like run, but discards the final state and log.

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

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

    Like runEmpty, but discards the final state and log.

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

    Like runEmpty, but discards the final state and value.

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

    Like runEmpty, but discards the final value and log.

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

    Like run, but discards the final state and value.

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

    Like run, but discards the final value and log.

  39. def semiflatTransform[LL, SC, B](f: (L, SB, A) ⇒ F[(LL, SC, B)])(implicit F: Monad[F]): IndexedReaderWriterStateT[F, E, LL, SA, SC, B]

    Like transform, but does it in the monadic context F.

    Like transform, but does it in the monadic context F.

    scala> import cats.implicits._
    scala> type Env = String
    scala> type Log = List[String]
    scala> val xOpt0: IndexedReaderWriterStateT[Option, Env, Log, Int, Int, Int] = IndexedReaderWriterStateT.get
    scala> val xOpt: IndexedReaderWriterStateT[Option, Env, Log, Int, Int, Int] = xOpt0.tell("xxx" :: Nil)
    scala> val xHead: IndexedReaderWriterStateT[Option, Env, Log, Int, Int, String] = xOpt.semiflatTransform((l, s, a) => l.headOption.map(h => (l, s, h + a)))
    scala> val input = 5
    scala> xOpt.run("env", input)
    res0: Option[(Log, Int, Int)] = Some((List(xxx),5,5))
    scala> xHead.run("env", 5)
    res1: Option[(Log, Int, String)] = Some((List(xxx),5,xxx5))
  40. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  41. def tell(l: L)(implicit F: Functor[F], L: Semigroup[L]): IndexedReaderWriterStateT[F, E, L, SA, SB, A]

    Add a value to the log.

  42. def toString(): String
    Definition Classes
    AnyRef → Any
  43. 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.

  44. 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))
  45. 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))
  46. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  49. 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