
1 Jun
2018
1 Jun
'18
2:32 p.m.
True. I think I would propose instance (Bounded a, Bounded b, Enum a, Enum b) => Enum (Either a b) instance (Bounded a, Bounded b) => Enum (Bounded a b) instance (Bounded a, Bounded b, Enum a, Enum b) => Enum (a, b) On Fri, Jun 01, 2018 at 02:23:58PM -0400, Li-yao Xia wrote:
One issue is that (Int, Int) is too big to define toEnum/fromEnum.
On 06/01/2018 02:10 PM, Tom Ellis wrote:
I'm a bit surprised that whilst `Either` and `(,)` have instances for `Ord`
* `(,)` has no instance for `Enum` * `Either` has no instance for `Enum` or `Bounded`
Is there a particular reason for that? It might be tricky to implement
toEnum :: Int -> a fromEnum :: a -> Int
but in the presence of `Bounded` that should be possible.