O'Reilly logo
  • R L thinks this is interesting:

algebraic data type


Cover of Real World Haskell


check: wikipedia definition of algebraic data type

algebraic data type includes product types and sum types (disjoint unions, variant types), the former one is the normal type like BookInfo, the other one can have multiple variants and multiple constructors. enum is a special sum type whose constructors take no arguments.

Till now, I know when define a type, we shall provides type name and value constructor name. Because haskell supports disjoint unions which can have multiple variants which need multiple constructors.