首页 > 解决方案 > 从 utop 检索文档

问题描述

有没有办法 直接从 utop.xml检索文档,在此处以 html 显示。

我可以通过使用获取类型

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 ‑&gt; Stdio__.Import.char Stdio__.Import.option

Read one character from the given input channel. 
Return None if there are no more characters to read.

标签: ocamlutop

解决方案


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

然后#doc将提供一个指令,并向您展示您想要的内容。

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


推荐阅读