5

Is there a way to retrieve the documentation, displayed in html here directly from utop.

I can get the type by using

utop # open Core;;
─( 10:41:50 )─< command 4 >─────────────────────────────────────────────────────────────────────────{ counter: 0 }─
utop # #typeof "In_channel.input_char";;
val Core.In_channel.input_char : Core.In_channel.t -> Base.char Base.option
─( 10:41:54 )─< command 5 >─────────────────────────────────────────────────────────────────────────{ counter: 0 }─

or

utop # #show In_channel.input_char;;
val input_char : in_channel -> char option
─( 10:43:00 )─< command 7 >────────────────────────────────────────────────────────────{ counter: 0 }─
utop #

but the doc is richer

  val input_char : t ‑> Stdio__.Import.char Stdio__.Import.option

Read one character from the given input channel. 
Return None if there are no more characters to read.
nicolas
  • 9,549
  • 3
  • 39
  • 83

1 Answers1

2

If you want the doc directly from utop, you can install this package from opam: https://github.com/reynir/ocp-index-top

Then a #doc directive will be available and show you what you want.

An alternative is to use ocp-browser. That can display all the types and the documentation.

Louis Roché
  • 876
  • 1
  • 7
  • 19
  • excellent ! do you know why that does not compile with 4.07.0 ? I don't see this constraint anywhere in https://github.com/reynir/ocp-index-top yet I get a message to that effect "$ opam install ocp-index-top [ruby-2.3.7p456] The following dependencies couldn't be met: - ocp-index-top → ocp-index → ocaml < 4.07 → ocaml-base-compiler < 4.07.0 conflict with the base packages of this switch" – nicolas Nov 02 '18 at 16:00
  • From what I gathered, a release of ocp-index is required to get compatibility with 4.07. Hope it will happen soon. – Louis Roché Nov 03 '18 at 20:24