shapeless-guide icon indicating copy to clipboard operation
shapeless-guide copied to clipboard

Lazy, section 3.4.2

Open mikkka opened this issue 8 years ago • 0 comments

After adding following code to example(cvs.scala, object Main) I've got java.lang.StackOverflowError

  sealed trait Tree[A]
  case class Branch[A](left: Tree[A], right: Tree[A]) extends Tree[A]
  case class Leaf[A](value: A) extends Tree[A]
  val tree1 = Branch(
    Branch(Leaf(1), Leaf(2)),
    Branch(Leaf(3), Leaf(4))
  )
  val tree2 = Branch(
    Branch(Leaf(21), Leaf(22)),
    Branch(Leaf(23), Leaf(24))
  )

  println("Trees as CSV:\n" + writeCsv(List(tree1, tree2)))

mikkka avatar Jul 13 '17 11:07 mikkka