相关疑难解决方法(0)

进一步细化父项签名中嵌套模块的签名

我有一个包含嵌套模块的ML文件.例如:

let f n = n + 1

module type M_type = sig
  val g : int -> int
  val h : int -> int
end

module M : M_type = struct
  let g n = n + 2
  let h n = n + 3
end

let j n = n |> M.h |> M.g |> f
Run Code Online (Sandbox Code Playgroud)

在为ML编写MLI时,我希望不要公开M.h,但我希望揭露M.g.

如下:

module type M_type = sig
  val g : int -> int
end

module M : M_type …
Run Code Online (Sandbox Code Playgroud)

ocaml

2
推荐指数
1
解决办法
156
查看次数

标签 统计

ocaml ×1