【发布时间】:2018-06-10 06:16:49
【问题描述】:
有没有办法将多个变体组合成一个?像这样的:
type pet = Cat | Dog;
type wild_animal = Deer | Lion;
type animal = pet | wild_animal;
这是一个语法错误,但我希望 animal 成为具有四个构造函数的变体:Cat | Dog | Deer | Lion。有没有办法做到这一点?
【问题讨论】:
标签: types ocaml variant reason