从 utop 检索文档

retrieving documentation from utop

有没有办法检索显示在 html here 中的文档 直接来自 utop。

我可以使用

得到类型
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 }─

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

但文档更丰富

  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.

如果你想直接从 utop 获取文档,你可以从 opam 安装这个包:https://github.com/reynir/ocp-index-top

然后 #doc 指令将可用并显示您想要的内容。

另一种方法是使用 ocp-browser。可以显示所有类型和文档。