我在使用 OCaml 实现 Chris Okasaki 的 Purely Functional Data Structures 中的一些数据结构时乱七八糟,遇到了这种类型定义:
type tree = Node of int * int * tree list;;
我认为它不需要标签,因为它不是联合类型,所以我尝试消除标签,但是出现以下错误:
# type tree = int * int * tree list;;
Characters 5-33:
type tree = int * int * tree list;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The type abbreviation tree is cyclic
为什么两个看似等效的类型定义会发生这种情况?