whole_func_string: function flatten(tree) {
    if (!(tree.root instanceof RoseTree)) {
      throw new TypeError("Can't call flatten when elements aren't trees");
    }
  
    return new RoseTree(
      tree.root.root,
      function() {
        var innerChildren = tree.root.children();
        var outerChildren = tree.children().map(flatten);
        return outerChildren.concat(innerChildren);
      }
    );
  }
func_code_string: function flatten(tree) {
    if (!(tree.root instanceof RoseTree)) {
      throw new TypeError("Can't call flatten when elements aren't trees");
    }
  
    return new RoseTree(
      tree.root.root,
      function() {
        var innerChildren = tree.root.children();
        var outerChildren = tree.children().map(flatten);
        return outerChildren.concat(innerChildren);
      }
    );
  }
func_documentation_string: "Flatten" a tree one level. (Monadic join.) RoseTree (RoseTree a) -> RoseTree a