Haskell笔记 (13)—— Algebraic data type

Algebraic data type可以拥有多个value constructor。比如Bool类型就是一种algebraic data type

data Bool = False | True

每个value constructor可以有0个或多个参数。

使用data关键字定义的数据类型,其实都是algebraic data type,只不过其只包含了一个value constructor