gpt4 book ai didi

ocaml - 如何在 mli 文件中声明模块(实际上是 Set.Make)?

转载 作者:行者123 更新时间:2023-12-04 13:51:34 26 4
gpt4 key购买 nike

我有 airport.mliairport.ml .

airport.ml , 我有

module AirportSet = Set.Make(struct type t = airport let compare = compare end);;

这没有问题。

然后我有一个功能
val get_all_airport : unit -> AirportSet.t;;

,这会生成 AirportSet .

所以在 airport.mli , 我需要显示 module AirportSet所以 AirportSet被认可。

我怎样才能做到这一点?

最佳答案

module AirportSet : (Set.S with type elt = airport)

(括号实际上是不必要的,将它们放在那里以便您知道这是预期的签名,在一般情况下为 sig ... end )。

关于ocaml - 如何在 mli 文件中声明模块(实际上是 Set.Make)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16548069/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com