ocaml-down 0.0.3 OCaml toplevel (REPL) upgrade

Down is an unintrusive user experience upgrade for the ocaml toplevel (REPL).

Simply load the zero dependency down library in the ocaml toplevel and you get line edition, history, session support and identifier completion and documentation with ocp-index.

Add this to your ~/.ocamlinit:

#use "down.top"

You may also need to add this to your ~/.ocamlinit and declare the environment variable OCAML_TOPLEVEL_PATH:

let () =
  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
  with Not_found -> ()

OR

let () = String.split_on_char ':' (Sys.getenv "OCAMLPATH")
         |> List.filter (fun x -> Filename.check_suffix x "/site-lib")
         |> List.map (fun x -> x ^ "/toplevel")
         (* remove the line below if you don't want to see the text
            every time you start the toplevel *)
         |> List.map (fun x -> Printf.printf "adding directory %s\n" x; x)
         |> List.iter Topdirs.dir_directory;;