Export user input history from OCaml utop to file

ocaml, utop

Solution

Your input is saved by default at ~/.utop-history . Isn't that enough for your purpose?

You can also change location and file size by manipulating UTop.history_file_name and other variables.

Problem

When I'm using OCaml `utop` every line of the input and output is printed into the console: ``` ───┬──────────────────────────────────────────────────────────────┬─── │ Welcome to utop version 2.10.0 (using OCaml version 4.14.0)! │ └──────────────────────────────────────────────────────────────┘ Type #utop_help for help about using utop. ─( 22:17:51 )─< command 0 >─────────────────────────────{ counter: 0}─ utop # let x = 50;; val x : int = 50 ``` Is it possible to export each of user inputs and outputs from `utop` session into specific file?

Original source