Re: Enum and bounded instances for (,) and Either
Henning Thielemann <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.libraries |
|---|---|
| Message-ID | <[email protected]> |
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. _______________________________________________ Libraries mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries