Questions tagged [algebraic-data-types]

For questions about algebraic data types, a language feature for creating composite types and values of them. Specific questions may also want to use the sum-types or product-types tags.

Filter by
Sorted by
Tagged with
10 votes
1 answer
432 views

Towards a better default listlike datastructure for functional languages

In most functional languages I know of, linked lists are the default datastructure of choice for many operations. The benefits are clear - they're clearly encoded with ADTs, and can be utilised easily ...
blueberry's user avatar
  • 1,582
7 votes
3 answers
334 views

How to incorporate sum types into SQL?

The blog post states that a major drawback of SQL is its lack of sum type support. Assuming we could redesign SQL today (without necessarily having to worry about compatibility) what are some specific ...
Jw C's user avatar
  • 121
8 votes
0 answers
108 views

How does GADTs as in Haskell-like languages compare to indexed families in dependent types?

In Haskell, GADTs are only indexed by types, while indexed families in DT are mainly indexed by terms. With the presence of without-K, it is hard to refute cases just by unifying type terms, while in ...
ice1000's user avatar
  • 2,294
6 votes
1 answer
178 views

Are there disadvantages to having subtypes of algebraic data types?

Many languages support algebraic data types which are essentially tagged unions of tuples or structs. For example, suppose we have a type for an expression node in an AST: ...
kaya3's user avatar
  • 16.3k
4 votes
3 answers
207 views

What is implied by the names "sum type" and "product type"?

Algebraic data types include two concepts with names that feel like they imply something clever, but that I can't for the life of me understand: Sum type: This refers to tagged unions, like Rust's ...
Rydwolf Programs's user avatar