15 ms·
They're not similar at all. Algebraic data types are finite sums and (tensor) products. Abstract data types are existential types, which are infinite sums index
by catnaroek 11y ago
They're not similar at all. Algebraic data types are finite sums and (tensor) products. Abstract data types are existential types, which are infinite sums indexed by a kind.
- tel 11y agoWhat makes them weak?
- catnaroek 11y agoWhen you unpack a weak existential type repeatedly, every time you get a fresh new type. When you unpack a strong existential repeatedly, you always get the same type. Anyway, my original comment was wrong: in ML, every time you project a type component from a module, you always get the same type. So it's more like a strong existential. My bad.
- tel 11y agoAh, gotcha. Thanks!
- pjmlp 11y agoThe purpose of my remark is how they look like in terms of usage for the humble programmer. They being similar how having a limited data structure (non extensible) with a set of functions that operate on it. Depending on the FP language ADTs can also partially hide their implementation like the Abstract Data Types in modular languages. But I can also happily discuss the math theory and the denotational semantics about them across languages, but I don't think it will help for many readers.