I'm a new OCaml-learner, and I'm trying to print some S-expressions, using Jane Street's Sexplib (included with Core):
let rec print_source ?(channel = stdout) sexps =
let formatter = Format.formatter_of_out_channel channel in
Sexp.pp_hum formatter |> List.iter sexps
However, this doesn't seem to be outputting anything to stdout
. If I replace it with a non-Format-using version, it works fine:
let rec print_source ?(channel = stdout) sexps =
Sexp.output_hum channel |> List.iter sexps
Any OCaml know-how is appreciated! (Also, happy to hear if this is super-unidiomatic, and I'm just Doing It Wrong )