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 IndexedStateT[F[_], SA, SB, A] extends Serializable

IndexedStateT[F, SA, SB, A] is a stateful computation in a context F yielding a value of type A. The state transitions from a value of type SA to a value of type SB.

Note that for the SA != SB case, this is an indexed monad. Indexed monads are monadic type constructors annotated by an additional type for effect tracking purposes. In this case, the annotation tracks the initial state and the resulting state.

Given IndexedStateT[F, S, S, A], this yields the StateT[F, S, A] monad.

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

Instance Constructors

  1. new IndexedStateT(runF: F[(SA) ⇒ F[(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]): IndexedStateT[F, SA, SC, B]
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. def contramap[S0](f: (S0) ⇒ SA)(implicit F: Functor[F]): IndexedStateT[F, S0, SB, A]
  8. def dimap[S0, S1](f: (S0) ⇒ SA)(g: (SB) ⇒ S1)(implicit F: Functor[F]): IndexedStateT[F, S0, S1, A]
  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[B, SC](fas: (A) ⇒ IndexedStateT[F, SB, SC, B])(implicit F: FlatMap[F]): IndexedStateT[F, SA, SC, B]
  13. def flatMapF[B](faf: (A) ⇒ F[B])(implicit F: FlatMap[F]): IndexedStateT[F, SA, SB, B]
  14. def get(implicit F: Functor[F]): IndexedStateT[F, SA, SB, SB]

    Get the input state, without modifying the state.

  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]): IndexedStateT[F, 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 map[B](f: (A) ⇒ B)(implicit F: Functor[F]): IndexedStateT[F, SA, SB, B]
  20. def mapK[G[_]](f: ~>[F, G])(implicit F: Functor[F]): IndexedStateT[G, SA, SB, A]

    Modify the context F using transformation f.

  21. def modify[SC](f: (SB) ⇒ SC)(implicit F: Functor[F]): IndexedStateT[F, SA, SC, A]

    Modify the state (S) component.

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. def run(initial: SA)(implicit F: FlatMap[F]): F[(SB, A)]

    Run with the provided initial state value

  26. def runA(s: SA)(implicit F: FlatMap[F]): F[A]

    Run with the provided initial state value and return the final value (discarding the final state).

  27. def runEmpty(implicit S: Monoid[SA], F: FlatMap[F]): F[(SB, A)]

    Run with S's empty monoid value as the initial state.

  28. def runEmptyA(implicit S: Monoid[SA], F: FlatMap[F]): F[A]

    Run with S's empty monoid value as the initial state and return the final value (discarding the final state).

  29. def runEmptyS(implicit S: Monoid[SA], F: FlatMap[F]): F[SB]

    Run with S's empty monoid value as the initial state and return the final state (discarding the final value).

  30. val runF: F[(SA) ⇒ F[(SB, A)]]
  31. def runS(s: SA)(implicit F: FlatMap[F]): F[SB]

    Run with the provided initial state value and return the final state (discarding the final value).

  32. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  33. def toString(): String
    Definition Classes
    AnyRef → Any
  34. def transform[B, SC](f: (SB, A) ⇒ (SC, B))(implicit F: Functor[F]): IndexedStateT[F, SA, SC, B]

    Like map, but also allows the state (S) value to be modified.

  35. def transformF[G[_], B, SC](f: (F[(SB, A)]) ⇒ G[(SC, B)])(implicit F: FlatMap[F], G: Applicative[G]): IndexedStateT[G, 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> val xError: IndexedStateT[ErrorOr, Int, Int, Int] = IndexedStateT.get
    scala> val xOpt: IndexedStateT[Option, Int, Int, Int] = xError.transformF(_.toOption)
    scala> val input = 5
    scala> xError.run(input)
    res0: ErrorOr[(Int, Int)] = Right((5,5))
    scala> xOpt.run(5)
    res1: Option[(Int, Int)] = Some((5,5))
  36. def transformS[R](f: (R) ⇒ SA, g: (R, SB) ⇒ R)(implicit F: Functor[F]): IndexedStateT[F, R, R, A]

    Transform the state used.

    Transform the state used.

    This is useful when you are working with many focused StateTs and want to pass in a global state containing the various states needed for each individual StateT.

    scala> import cats.implicits._ // needed for StateT.apply
    scala> type GlobalEnv = (Int, String)
    scala> val x: StateT[Option, Int, Double] = StateT((x: Int) => Option((x + 1, x.toDouble)))
    scala> val xt: StateT[Option, GlobalEnv, Double] = x.transformS[GlobalEnv](_._1, (t, i) => (i, t._2))
    scala> val input = 5
    scala> x.run(input)
    res0: Option[(Int, Double)] = Some((6,5.0))
    scala> xt.run((input, "hello"))
    res1: Option[(GlobalEnv, Double)] = Some(((6,hello),5.0))
  37. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped