PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Algebraic Data Type

Algebraic Data Type

Algebraic Data Type is a feature.

In computer programming, especially functional programming and type theory, an algebraic data type is a kind of composite type, i.e., a type formed by combining other types. Two common classes of algebraic types are product types (i.e., tuples and records) and sum types (i.e., tagged or disjoint unions, coproduct types or variant types).The values of a product type typically contain several values, called fields. All values of that type have the same combination of field types. Read more on Wikipedia...


Languages with Algebraic Data Type include TypeScript, Coconut

Example from TypeScript:
declare type numOrString = string | number
Example from Coconut:
data Empty() data Leaf(n) data Node(l, r) def size(Empty()) = 0 addpattern def size(Leaf(n)) = 1 addpattern def size(Node(l, r)) = size(l) + size(r)
pattern-matching-feature.html 路 algebraic-types-feature.html 路 expressions-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 28 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com