ocaml:utop,有没有办法列出模块的所有功能?

ocaml:utop,有没有办法列出模块的所有功能?,ocaml,utop,Ocaml,Utop,在utop中,当打开库(通过~require…)或打开模块(通过open module_name)时,是否有方法获取库或模块的内容?utop通过完成标签提供了这个功能,但我想一次看到所有的功能 不一定在utop中,您可以使用以下内容: # module type S = module type of Module_of_your_interest;; module type S = sig ... ... end 警告:某些模块的签名非常大。在utop中,您可以使用#s

在utop中,当打开库(通过~require…)或打开模块(通过open module_name)时,是否有方法获取库或模块的内容?utop通过完成标签提供了这个功能,但我想一次看到所有的功能

不一定在utop中,您可以使用以下内容:

# module type S = module type of Module_of_your_interest;;
module type S =
  sig
    ...
    ...
  end

警告:某些模块的签名非常大。

utop
中,您可以使用
#show
命令。比如说

utop # #show Stack;;
module Stack :
  sig
    type 'a t
    exception Empty
    val create : unit -> 'a t
    val push : 'a -> 'a t -> unit
    val pop : 'a t -> 'a
    val top : 'a t -> 'a
    val clear : 'a t -> unit
    val copy : 'a t -> 'a t
    val is_empty : 'a t -> bool
    val length : 'a t -> int
    val iter : ('a -> unit) -> 'a t -> unit
  end

如果您对库中可用的函数名感兴趣,可以编写:

#module S = Library_name;;
例如:

#module M = String;;
输出将是:

模块M:sig 外部长度:string->int=“%string\u length” 外部获取:string->int->char=“%string\u safe\u get” 外部设置:string->int->char->unit=“%string\u safe\u set” 外部创建:int->string=“caml\u创建\u字符串” val生成:int->char->string val复制:字符串->字符串 val子项:字符串->整数->整数->字符串 val填充:字符串->整数->整数->字符->单位 val blit:字符串->整数->字符串->整数->整数->单位 val concat:string->string list->string 值输入:(字符->单位)->字符串->单位 val iteri:(整数->字符->单位)->字符串->单位 val映射:(字符->字符)->字符串->字符串 val修剪:字符串->字符串 val转义:字符串->字符串 val索引:字符串->字符->整数 val-rindex:string->char->int val index_from:string->int->char->int val rindex_from:string->int->char->int val包含:字符串->字符->布尔 val包含以下内容:字符串->整数->字符->布尔 val rcontains_from:string->int->char->bool val大写:string->string val小写:字符串->字符串 val大写:字符串->字符串 val取消资本化:字符串->字符串 类型t=字符串 val比较:t->t->int 外部不安全获取:string->int->char=“%string\u不安全获取” 外部设置:字符串->整数->字符->单位 =%string\u不安全\u集 外部不安全提示:字符串->整数->字符串->整数->整数->单位 =“caml\u blit\u字符串”“noalloc” 外部填充:字符串->整数->整数->字符->单位 =“caml_填充字符串”“noalloc”结束

之后,您甚至可以使用M作为String的别名。e、 g:

# M.concat " " ["one"; "two"; "three"];;

为了完整性:在ocaml顶级中,这将是
#show#u模块堆栈如何获取函数的“docstring”?比如说我想知道hat Stack.pop是干什么的?