OCaml 中的高阶模块
higher order modules in OCaml
OCaml 仿函数以 OCaml 仿函数作为参数,或返回 OCaml 仿函数从未在 manual.
中提及
是否存在阻止 OCaml 具有高阶模块的技术原因?
支持高阶仿函数并按预期工作:
module type endo = sig
module type t
module F: t -> t
end
module Twice(F:endo) = struct
module type t = F.t
module F(X:t) = F.F(F.F(X))
end
手册仅仅认为这是一个不足为奇的功能。
OCaml 仿函数以 OCaml 仿函数作为参数,或返回 OCaml 仿函数从未在 manual.
中提及是否存在阻止 OCaml 具有高阶模块的技术原因?
支持高阶仿函数并按预期工作:
module type endo = sig
module type t
module F: t -> t
end
module Twice(F:endo) = struct
module type t = F.t
module F(X:t) = F.F(F.F(X))
end
手册仅仅认为这是一个不足为奇的功能。