为什么不能为 F# 结构元组声明类型别名?

Why is it impossible to declare a type alias to an F# struct tuple?

无法在 F# 中为结构元组定义类型别名。只有使用解决方法,它才有效。

let x = struct (1, 2)
> val x : struct (int * int) = struct (1, 2)

let y : struct (int * int) = struct (4, 5) // explicit type
> val y : struct (int * int) = struct (4, 5)

type S = struct (int * int) // straight definition
> error FS0010: Unexpected symbol '(' in member definition

type S = ValueTuple<int, int> // workaround
> [<Struct>]
  type S = struct (int * int)

“type S = struct (int * int)”的错误是编译器错误吗?

尝试提交错误并在此处找到答案:https://github.com/dotnet/fsharp/issues/7014

类型周围的括号是必需的:

type Alias = (struct(int * int))