以下代码将报告语法错误消息:
type 'a edge =
|Empty
|End of 'a * 'a vertex * 'a vertex and
type 'a vertex =
|Empty
|Vertex of 'a * 'a edge list;;
如何定义两种相互引用的类型?
答案 0 :(得分:6)
第二个type
在语法上不正确:
type 'a edge =
|Empty
|End of 'a * 'a vertex * 'a vertex
and 'a vertex =
|Empty
|Vertex of 'a * 'a edge list;;