我有两个模块A.ml,B.ml就像这样:
A.ml:
type t = int
let from_int (i : int) : t = i
B.ml:
open A
let my_t : t = from_int 0
我可以通过调用来编译它们,ocamlc A.ml B.ml但是我不知道如何加载它们utop以便my_t交互使用。使用:
utop -init B.ml产量Error: Reference to undefined global 'A'utop紧随其后#use "A.ml";;并#use "B.ml";;导致相同的错误- 删除
open AfromB.ml使这项双重#use工作,但ocamlc A.ml B.ml现在失败B了Error: Unbound type constructor t.