【发布时间】:2016-06-01 19:32:17
【问题描述】:
我正在使用 Core.Std 在 .ml 文件中生成 Set 和 Map:
type temp = int with sexp, compare
type label = Symbol.symbol with sexp, compare
module Temp = struct
type t = temp with sexp, compare
end
module TempComp = Comparable.Make(Temp)
module TempSet = TempComp.Set
module TempMap = TempComp.Map
module Label = struct
type t = label with sexp, compare
end
module LabelComp = Comparable.Make(Label)
module LabelMap = LabelComp.Map
我应该如何在我的.mli 文件中描述TempSet, TempMap, LabelMap?
我说:
module TempMap : Map.S with type t = temp
但我得到了一个错误:
在这个 `with' 约束中, t 的新定义 与约束签名中的原始定义不匹配: 类型声明不匹配: 类型 t = t 不包括在 type 'a t = (Key.t, 'a, Key.comparator_witness) Map.t
我该如何解决这个错误?
【问题讨论】:
标签: ocaml