6 ms·
These types don't seem to escape the scope of what can be described with algebraic types, but the relationships between them seem like you're looking for a noti
by gue5t 3y ago
These types don't seem to escape the scope of what can be described with algebraic types, but the relationships between them seem like you're looking for a notion of type-level functions: subset ≡ X => 2^X, partial ≡ A×B => (A+1)×partial(B)
- qazxcvbnm 3y agoConsider the case of Partials - we might like to restrict the Partials to different subsets of the fields for different purposes; consider the modelling of an inverted index. Certainly it is possible to represent each specific case as some algebraic type; but beyond trivial cases, I find that when I need such of these types, quickly I discover that there are myriad ways to express them, none of them uniquely natural, unlike the way a sum of products type (and its terms) can be pretty much unambiguously drawn from a specification. This matters especially when e.g. I need to evolve my types in a data migration.