为模块分配签名

  • 本文关键字:分配 模块 module ocaml
  • 更新时间 :
  • 英文 :


我正在阅读使用Ocaml的Tezos白皮书,我在理解语法方面有困难。我只知道基本的ocaml,对模块不太熟悉。

module Context = sig
type t
type key = string list
val get: t -> key -> Bytes.t option Lwt.t
val set: t -> key -> Bytes.t -> t Lwt.t
val del: t -> key -> t Lwt.t
(*...*)
end

module Context代替module type Context,这是什么意思?这只是一个打字错误,还是有不同的意思?我只发现了使用struct分配模块的例子。

在我看来这是一个错误。如您所说,sig ... end是模块类型。所以它不能是模块,也就是这种类型的值。如果我输入您的代码,我会在令牌sig上得到语法错误,这是我所期望的。

最有可能遗漏type:modulel type Context = sig ... end.

最新更新