Tree

sealed abstract
class Tree[A]

A multi-way tree, also known as a rose tree. Also known as Cofree[Stream, A].

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def rootLabel: A

The label at the root of this tree.

The label at the root of this tree.

The child nodes of this tree.

The child nodes of this tree.

Concrete methods

def cobind[B](f: Tree[A] => B): Tree[B]

Binds the given function across all the subtrees of this tree.

Binds the given function across all the subtrees of this tree.

def drawTree(implicit sh: Show[A]): String

A 2D String representation of this Tree.

A 2D String representation of this Tree.

def flatMap[B](f: A => Tree[B]): Tree[B]

Pre-order traversal.

Pre-order traversal.

def foldMap[B : Monoid](f: A => B): B

Maps the elements of the Tree into a Monoid and folds the resulting Tree.

Maps the elements of the Tree into a Monoid and folds the resulting Tree.

def foldMapTrampoline[B : Monoid](f: A => B): Trampoline[B]
def foldNode[Z](f: A => EphemeralStream[Tree[A]] => Z): Z
def foldRight[B](z: => B)(f: (A, => B) => B): B

Breadth-first traversal.

Breadth-first traversal.

def loc: TreeLoc[A]

A TreeLoc zipper of this tree, focused on the root node.

A TreeLoc zipper of this tree, focused on the root node.

def map[B](f: A => B): Tree[B]
def scanr[B](g: (A, EphemeralStream[Tree[B]]) => B): Tree[B]

A histomorphic transform. Each element in the resulting tree is a function of the corresponding element in this tree and the histomorphic transform of its children.

A histomorphic transform. Each element in the resulting tree is a function of the corresponding element in this tree and the histomorphic transform of its children.

def traverse1[G[_] : Apply, B](f: A => G[B]): G[Tree[B]]
def unzip[A1, A2](p: A => (A1, A2)): (Tree[A1], Tree[A2])

Turns a tree of pairs into a pair of trees.

Turns a tree of pairs into a pair of trees.