retrieving documentation from utop

1k views Asked by At

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.
1

There are 1 answers

2
Louis Roché On BEST ANSWER

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.