final case class Cofree[S[_], A](head: A, tail: Eval[S[Cofree[S, A]]]) extends Product with Serializable
A free comonad for some branching functor S
. Branching is done lazily using Eval.
A tree with data at the branches, as opposed to Free which is a tree with data at the leaves.
Not an instruction set functor made into a program monad as in Free, but an instruction set's outputs as a
functor made into a tree of the possible worlds reachable using the instruction set.
This Scala implementation of Cofree
and its usages are derived from
Scalaz's Cofree,
originally written by Rúnar Bjarnason.
- Source
- Cofree.scala
- Alphabetic
- By Inheritance
- Cofree
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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() @IntrinsicCandidate()
-
def
coflatMap[B](f: (Cofree[S, A]) ⇒ B)(implicit S: Functor[S]): Cofree[S, B]
Map
f
over each subtree of the computation. -
def
coflatten(implicit S: Functor[S]): Cofree[S, Cofree[S, A]]
Replace each node in the computation with the subtree from that node downwards
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
extract: A
Alias for head.
-
def
forceAll(implicit S: Functor[S]): Cofree[S, A]
Evaluate the entire Cofree tree.
-
def
forceTail: Cofree[S, A]
Evaluate just the tail.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- val head: A
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
map[B](f: (A) ⇒ B)(implicit S: Functor[S]): Cofree[S, B]
Map over head and inner
S[_]
branches. -
def
mapBranchingRoot(nat: ~>[S, S])(implicit S: Functor[S]): Cofree[S, A]
Transform the branching functor at the root of the Cofree tree.
-
def
mapBranchingS[T[_]](nat: ~>[S, T])(implicit S: Functor[S]): Cofree[T, A]
Transform the branching functor, using the S functor to perform the recursion.
-
def
mapBranchingT[T[_]](nat: ~>[S, T])(implicit T: Functor[T]): Cofree[T, A]
Transform the branching functor, using the T functor to perform the recursion.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- val tail: Eval[S[Cofree[S, A]]]
-
def
tailForced: S[Cofree[S, A]]
Evaluates and returns the tail of the computation.
-
def
transform[B](f: (A) ⇒ B, g: (Cofree[S, A]) ⇒ Cofree[S, B])(implicit S: Functor[S]): Cofree[S, B]
Applies
f
to the head andg
to the tail. -
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()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )