Packages

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.

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

Instance Constructors

  1. new Cofree(head: A, tail: Eval[S[Cofree[S, 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 clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. def coflatMap[B](f: (Cofree[S, A]) ⇒ B)(implicit S: Functor[S]): Cofree[S, B]

    Map f over each subtree of the computation.

  7. def coflatten(implicit S: Functor[S]): Cofree[S, Cofree[S, A]]

    Replace each node in the computation with the subtree from that node downwards

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def extract: A

    Alias for head.

  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def forceAll(implicit S: Functor[S]): Cofree[S, A]

    Evaluate the entire Cofree tree.

  12. def forceTail: Cofree[S, A]

    Evaluate just the tail.

  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. val head: A
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def map[B](f: (A) ⇒ B)(implicit S: Functor[S]): Cofree[S, B]

    Map over head and inner S[_] branches.

  17. def mapBranchingRoot(nat: ~>[S, S])(implicit S: Functor[S]): Cofree[S, A]

    Transform the branching functor at the root of the Cofree tree.

  18. 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.

  19. 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.

  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  24. val tail: Eval[S[Cofree[S, A]]]
  25. def tailForced: S[Cofree[S, A]]

    Evaluates and returns the tail of the computation.

  26. 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 and g to the tail.

  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped