[Haskell-cafe] No Enum for (,), no Enum or Bounded for Either

Li-yao Xia lysxia at gmail.com
Fri Jun 1 18:23:58 UTC 2018


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.
> 
> Tom
> 
> 
> _______________________________________________
> 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.
> 


More information about the Haskell-Cafe mailing list