
I made a typo in the second one. It should be instance (Bounded a, Bounded b) => Bounded (Either a b) On Fri, Jun 01, 2018 at 07:32:55PM +0100, Tom Ellis wrote:
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.
Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.