Chris Okasaki の Purely Functional Data Structures のデータ構造のいくつかを実装する OCaml をいじっていたところ、この型定義に出くわしました。
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
一見同等に見える 2 つの型定義で、なぜこのようなことが起こるのでしょうか?