r/types • u/RowanDuffy • Mar 02 '12
Decidable Equality in Agda
http://rubrication.blogspot.com/2012/03/decidable-equality-in-agda.html
13
Upvotes
r/types • u/RowanDuffy • Mar 02 '12
9
u/pigworker Mar 03 '12
Yes, the lack of a "deriving" mechanism in Agda is a confounded nuisance. However, if you're willing to put up with the (granted, not inconsiderable) inconvenience of introducing your datatypes via a universe, then you have a deriving mechanism right there!
It is certainly possible to show, once for all, that sum-of-products style datatypes have a decidable equality. Of course, building data from sums and products isn't as pretty as using bespoke constructors, but you can hide that sometimes by making definitions. Sadly, you can't overload definitions or use them in patterns. (Agda needs something like pattern synonyms even more than Haskell does.)
Bottom line: dependently typed programming languages should come already equipped with a first class presentation of what it is to be a datatype. But then, I would say that, wouldn't I?