Class/Object

cats.free

Free

Related Docs: object Free | package free

Permalink

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

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

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Free
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def canEqual(that: Any): Boolean

    Permalink
    Definition Classes
    Equals
  2. abstract def productArity: Int

    Permalink
    Definition Classes
    Product
  3. abstract def productElement(n: Int): Any

    Permalink
    Definition Classes
    Product

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def compile[T[_]](f: FunctionK[S, T]): Free[T, A]

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def flatMap[B](f: (A) ⇒ Free[S, B]): Free[S, B]

    Permalink

    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.

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

    Permalink

    Catamorphism.

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

  12. final def foldMap[M[_]](f: FunctionK[S, M])(implicit M: Monad[M]): M[A]

    Permalink

    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 getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def go(f: (S[Free[S, A]]) ⇒ Free[S, A])(implicit S: Functor[S]): A

    Permalink

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

  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def inject[G[_]](implicit ev: InjectK[S, G]): Free[G, A]

    Permalink

    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(...)
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. final def map[B](f: (A) ⇒ B): Free[S, B]

    Permalink
  19. final def mapK[T[_]](f: ~>[S, T]): Free[T, A]

    Permalink

    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.

  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. def productIterator: Iterator[Any]

    Permalink
    Definition Classes
    Product
  24. def productPrefix: String

    Permalink
    Definition Classes
    Product
  25. final def resume(implicit S: Functor[S]): Either[S[Free[S, A]], A]

    Permalink

    Evaluate a single layer of the free monad.

    Evaluate a single layer of the free monad.

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

    Permalink

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

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

    Permalink

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

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

    Permalink

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

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

    Permalink

    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.

    Annotations
    @tailrec()
  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  31. def toString(): String

    Permalink
    Definition Classes
    Free → AnyRef → Any
  32. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped