scalaz/scalaz — Issue #42: TreeLoc.findChild doesn't find leaf nodes
Author: ziggystar
Created: 2011-10-31 12:17:26+00:00
State: open

scala> val t1 = node(1, Stream(leaf(2), node(3, Stream(leaf(4), leaf(5)))))
t1: scalaz.Tree[Int] =

scala> t1.flatten.tail.map(x => t1.loc.findChild(_.rootLabel == x)).force
res6: scala.collection.immutable.Stream[Option[scalaz.TreeLoc[Int]]] = Stream(Some(), Some(), None, None)

res6 should contain only Somes. And maybe remarking, that findChild will NOT find the root node would be nice. I expected it to also find the root.