
12 May
2021
12 May
'21
5:59 p.m.
On Wed, 12 May 2021, Sandy Maguire wrote:
Found myself puzzled the other day when I wanted an (Enum a, Enum b) => Enum (a, b) instance, and was distraught that it didn't exist.
The following is a reasonable implementation:
This is certainly an instance that fulfills some laws, but do we really want it or is it more likely an accident if someone writes, say, succ (a,b)? We already allow "max (a,b) (c,d)", which can be pretty counterintuitive. I think the Ord instance for pairs is currently mostly used for Set and Map, but a separate class for this purpose would have been better.