我偶然发现了F#中的这个问题.假设,我想声明两种相互引用的类型:
type firstType =
| T1 of secondType
//................
type secondType =
| T1 of firstType
//................
Run Code Online (Sandbox Code Playgroud)
我该怎么做,所以编译器不会生成错误?
下面的代码将报告语法错误消息:
type 'a edge =
|Empty
|End of 'a * 'a vertex * 'a vertex and
type 'a vertex =
|Empty
|Vertex of 'a * 'a edge list;;
Run Code Online (Sandbox Code Playgroud)
如何定义两种相互引用的类型?