My take on pretty printing a rose tree like the unix tree
command does. Inspired by
this
blog post of a version in OCaml.
It is pure and idiomatic without using any library functions. Thanks to laziness, it doesn't wait to return until the whole string is built. As such it will print a finite prefix of large or infinite trees (see example below).