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.
- Alphabetic
- By Inheritance
- Free
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
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. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
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.
-
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.
-
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
tailRecMto provide stack-safety. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
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.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
inject[G[_]](implicit ev: InjectK[S, G]): Free[G, A]
Lift into
G(typically aEitherK) givenInjectK.Lift into
G(typically aEitherK) givenInjectK. Analogous toFree.injectbut 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(...)
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def map[B](f: (A) ⇒ B): Free[S, B]
-
final
def
mapK[T[_]](f: ~>[S, T]): Free[T, A]
Modify the functor context
Susing transformationf.Modify the functor context
Susing transformationf.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. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
productIterator: Iterator[Any]
- Definition Classes
- Product
-
def
productPrefix: String
- Definition Classes
- Product
-
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()
-
final
def
run(implicit S: Comonad[S]): A
Run to completion, using the given comonad to extract the resumption.
-
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
Sto a monadM. -
final
def
runTailRec(implicit S: Monad[S]): S[A]
Run to completion, using monadic recursion to evaluate the resumption in the context of
S. -
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.
- Annotations
- @tailrec()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- final def toFreeT[G[_]](implicit arg0: Applicative[G]): FreeT[S, G, A]
-
def
toString(): String
- Definition Classes
- Free → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()