package opam-core

  1. Overview
  2. Docs

Tree printing

type 'elt t
val value : 'elt t -> 'elt
val children : 'elt t -> 'elt t list
val create : ?children:'a t list -> 'a -> 'a t

Creates a tree node.

type symbols = {
  1. vert : string;
    (*

    |

    *)
  2. hor : string;
    (*
    *)
  3. tee : string;
    (*

    |-

    *)
  4. hook : string;
    (*

    '-

    *)
}

The symbols to be used in the tree printer.

val get_default_symbols : unit -> symbols

Returns UTF8 or ASCII tree symbols depending on utf8 ().

val print : ?symbols:symbols -> printer:('a -> string) -> 'a t -> unit

Prints the given tree as a Unicode/ASCII art.

  • parameter printer

    may return a multi-line string, but should not return an empty string.

OCaml

Innovation. Community. Security.