algebraic data types

Tagged union constructs

Algebraic data types are a way of defining composite types in programming by combining simpler types.

A sum type offers alternatives—a value is one of several possibilities.

A product type bundles values together—a value contains all of several components.

Languages like Haskell, Rust, and ML make heavy use of them: The Result type is either Ok or Err.

The "algebraic" refers to how types can be added (sum) and multiplied (product) like mathematical operations.

Related

structures · composites · product type · product · constructors · variants · sum · monads · polymorphism · list · recursion · tuple · match · case · struct · tree · record · inductive

Categories
Family

algebra, algebraic, algebras, algebraically, prealgebra, linear algebra, datatype

Familiarity
Top 1,000,000
Profile
Used worldwide · Timeless · Abstract · Rated G