Ste*_*fly 2 ocaml types module include
我想定义以下模块层次结构,但它不起作用:
module type A = sig
type t
end
module type B = sig
type u
include A
end
module type C = sig
(* Error: Unbound type constructor u *)
include B with type t = u list
end
Run Code Online (Sandbox Code Playgroud)
为什么类型有错误u?
=应该在您尝试包含/修改的模块之外提供类型.
在这里,你会做:
module type C = sig
type u
include B with type u := u and type t = u list
end
Run Code Online (Sandbox Code Playgroud)