在utop中,当打开库(通过~requires ......)或打开模块时(通过打开Module_name),有没有办法获取库或模块的内容?utop通过完成选项卡提供此功能,但我希望立即看到所有功能.
不一定在utop中,您可以使用以下内容:
# module type S = module type of Module_of_your_interest;;
module type S =
sig
...
...
end
Run Code Online (Sandbox Code Playgroud)
警告:某些模块有很大的签名.
在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
Run Code Online (Sandbox Code Playgroud)