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 free
    Definition Classes
    cats
  • Cofree
  • ContravariantCoyoneda
  • Coyoneda
  • Free
  • FreeApplicative
  • FreeInvariantMonoidal
  • FreeT
  • Trampoline
  • Yoneda

sealed abstract class Free[S[_], A] extends Product with Serializable with FreeFoldStep[S, A]

A free operational monad for some functor S. Binding is done using the heap instead of the stack, allowing tail-call elimination.

Source
Free.scala
Linear Supertypes
FreeFoldStep[S, A], Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Free
  2. FreeFoldStep
  3. Serializable
  4. Serializable
  5. Product
  6. Equals
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def canEqual(that: Any): Boolean
    Definition Classes
    Equals
  2. abstract def productArity: Int
    Definition Classes
    Product
  3. abstract def productElement(n: Int): Any
    Definition Classes
    Product

Concrete 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 clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  6. final def compile[T[_]](f: FunctionK[S, T]): Free[T, A]

    Compile your free monad into another language by changing the suspension functor using the given natural transformation f.

    Compile your free monad into another language by changing the suspension functor using the given natural transformation f.

    If your natural transformation is effectful, be careful. These effects will be applied by compile.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def flatMap[B](f: (A) ⇒ Free[S, B]): Free[S, B]

    Bind the given continuation to the result of this computation.

    Bind the given continuation to the result of this computation. All left-associated binds are reassociated to the right.

  10. final def fold[B](r: (A) ⇒ B, s: (S[Free[S, A]]) ⇒ B)(implicit S: Functor[S]): B

    Catamorphism.

    Catamorphism. Run the first given function if Pure, otherwise, the second given function.

  11. final def foldLeft[B](fa: Free[S, A], b: B)(f: (B, A) ⇒ B)(implicit F: Foldable[S]): B
    Definition Classes
    FreeFoldStep
  12. final def foldMap[M[_]](f: FunctionK[S, M])(implicit M: Monad[M]): M[A]

    Catamorphism for Free.

    Catamorphism for Free.

    Run to completion, mapping the suspension with the given transformation at each step and accumulating into the monad M.

    This method uses tailRecM to provide stack-safety.

  13. final def foldRight[B](fa: Free[S, A], lb: Eval[B])(f: (A, Eval[B]) ⇒ Eval[B])(implicit F: Foldable[S]): Eval[B]
    Definition Classes
    FreeFoldStep
  14. final def foldStep[B](onPure: (A) ⇒ B, onSuspend: (S[A]) ⇒ B, onFlatMapped: ((S[X], (X) ⇒ Free[S, A]) forSome {type X}) ⇒ B): B

    A combination of step and fold.

    A combination of step and fold. May be used to define interpreters with custom (non-monoidial) control flow.

    Definition Classes
    FreeFoldStep
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  16. final def go(f: (S[Free[S, A]]) ⇒ Free[S, A])(implicit S: Functor[S]): A

    Run to completion, using a function that extracts the resumption from its suspension functor.

  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  18. final def inject[G[_]](implicit ev: InjectK[S, G]): Free[G, A]

    Lift into G (typically a EitherK) given InjectK.

    Lift into G (typically a EitherK) given InjectK. Analogous to Free.inject but lifts programs rather than constructors.

    scala> type Lo[A] = cats.data.EitherK[List, Option, A]
    defined type alias Lo
    
    scala> val fo = Free.liftF(Option("foo"))
    fo: cats.free.Free[Option,String] = Free(...)
    
    scala> fo.inject[Lo]
    res4: cats.free.Free[Lo,String] = Free(...)
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. final def map[B](f: (A) ⇒ B): Free[S, B]
  21. final def mapK[T[_]](f: ~>[S, T]): Free[T, A]

    Modify the functor context S using transformation f.

    Modify the functor context S using transformation f.

    This is effectively compiling your free monad into another language by changing the suspension functor using the given natural transformation f.

    If your natural transformation is effectful, be careful. These effects will be applied by mapK.

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  25. def productIterator: Iterator[Any]
    Definition Classes
    Product
  26. def productPrefix: String
    Definition Classes
    Product
  27. final def resume(implicit S: Functor[S]): Either[S[Free[S, A]], A]

    Evaluate a single layer of the free monad.

    Evaluate a single layer of the free monad.

    Annotations
    @tailrec()
  28. final def run(implicit S: Comonad[S]): A

    Run to completion, using the given comonad to extract the resumption.

  29. final def runM[M[_]](f: (S[Free[S, A]]) ⇒ M[Free[S, A]])(implicit S: Functor[S], M: Monad[M]): M[A]

    Run to completion, using a function that maps the resumption from S to a monad M.

  30. final def runTailRec(implicit S: Monad[S]): S[A]

    Run to completion, using monadic recursion to evaluate the resumption in the context of S.

  31. final def step: Free[S, A]

    Takes one evaluation step in the Free monad, re-associating left-nested binds in the process.

    Takes one evaluation step in the Free monad, re-associating left-nested binds in the process.

    Definition Classes
    Free → FreeFoldStep
    Annotations
    @tailrec()
  32. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  33. final def toFreeT[G[_]](implicit arg0: Applicative[G]): FreeT[S, G, A]
  34. def toString(): String
    Definition Classes
    Free → AnyRef → Any
  35. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  37. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from FreeFoldStep[S, A]

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped