0
我有以下模塊簽名A
:OCaml的簽名依賴關係錯誤
module type A =
sig
type exp =
Int of int
| Var of string
end;;
這我能爲了得到a.mli
和a.cmi
文件進行編譯。但是,如果我定義B
:
module type B =
sig
val compute : A.exp -> A.exp
end;;
運行ocamlc -i b.ml
產生錯誤Unbound type constructor A.exp
。這是爲什麼?
是否有可能用簽名以某種方式做到這一點,但避免'A.A'?我試圖從一些我沒有源碼的代碼複製簽名,只有簽名。雖然你的方法適用於類似於上面的類型定義,但我不知道如何爲'val'做到這一點。 – bellpeace