構造体の外側で使用するために構造体a内の中置演算子を宣言したいと思います。しかし、私は、構造が開かれたときでさえ、構造の外側で認識されるような "インフィックス"を得ることはできません。標準MLエクスポート演算子を構造体から中置
> structure A = struct infix 6 ++ fun a ++ b = a + b end;
structure A: sig val ++: int * int -> int end
> 1 A.++ 2;
poly: : error: Type error in function application.
Function: 1 : int
Argument: A.++ : int * int -> int
Reason: Value being applied does not have a function type
Found near 1 A.++ 2
Static Errors
> let open A in 1 ++ 2 end;
poly: : error: Type error in function application.
Function: 1 : int
Argument: ++ : int * int -> int
Reason: Value being applied does not have a function type
Found near let open A in 1 ++ 2 end
Static Errors
これは、標準MLの制限ですか。これはPoly/MLを使用した例です。
素晴らしい提案、ありがとうございます。 – eatonphil