2つのモジュールがあります。1つはバリアントタイプを定義します。
module A = struct
type foo = Bar of material | Baz | Boo
(* other stuff *)
end
foo
のバリアントをコンストラクターとしても、別のモジュールの左側としても使用できるようにしたいと思います。
module B = struct
type foo = A.foo (* I can abbreviate A.foo by assigning it a local alias *)
let f (x : foo) = match x with
| Bar m -> Bar (g m) (* Any way to abbreviate Bar and friends? *)
| Baz | Boo -> x
end
しかし、 「名前付きオブジェクトの参照」ごとに、バリアント名の前にモジュールパスを付ける必要があります。
let f (x : foo) = match x with
| A.Bar m -> A.Bar (g m)
| A.Baz | A.Boo -> x
open
他のすべてのものを取得してプルする以外にモジュールパスを使用しないようにスキップする方法はありますA
か?