世界上为什么会有“1/”。在“Ord: Set”和“OrderedType ->”之间?
这在 VSCode 环境中显示为
Set.Make
和 Map.Make
,也可能显示为其他内置 Make 仿函数。
来自 Yanny 的待定信息,这看起来你要么重新定义了模块,要么 VSCode 正在主动。考虑以下简单示例:
# module type S = sig
type t
end
module A (T : S) = struct
type t = T.t
end;;
module type S = sig type t end
module A : functor (T : S) -> sig type t = T.t end
# module B = A (Int)
let foo (x: B.t) = x + 1;;
module B : sig type t = Int.t end
val foo : B.t -> int = <fun>
# module B = A (Float)
let bar (x : B.t) = x +. 1.;;
module B : sig type t = Float.t end
val bar : B.t -> float = <fun>
# foo;;
- : B/2.t -> int = <fun>
注意
B/2
签名中类型的 foo
名称?这是因为我已经隐藏了早期模块的名称 B
,但是 foo
仍然可以访问它。