我定义了几个模块如下:
(* zone.ml *)
module ZoneFun (Prop : PROP) = (struct ... end: ZONE)
(* zones.ml *)
module ZonesFun (Zone : ZONE) = (struct ... end: ZONES)
模块和其他一些模块PROP
的接口在哪里。Type
(* calculate.ml *)
open Type
open Zone
open Zones
module ZoneType = ZoneFun(Type)
module ZonesType = ZonesFun(ZoneType)
let tries (x: ZonesType.t) : unit =
Printf.printf "haha"
(* abs.ml *)
open Type
open Zone
open Zones
open Calculate
module ZoneType = ZoneFun(Type)
module ZonesType = ZonesFun(ZoneType)
module Abs = struct
...
let abc (x: ZonesType.t) : unit =
Calculate.tries x
...
end
Calculate.tries x
然后编译在 in行给我一个错误abs.ml
:
Error: This expression has type ZonesType.t = Zones.ZonesFun(ZoneType).t
but an expression was expected of type
Calculate.ZonesType.t = Zones.ZonesFun(Calculate.ZoneType).t
我怎么能告诉编译Calculate.ZonesType.t
器实际上与ZonesType.t
of相同abs.ml
?