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

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Jun 2 05:39:28 UTC 2018


On Fri, Jun 01, 2018 at 10:21:45PM +0200, MarLinn wrote:
> 
> > Sorry, could you explain further?  I don't understand what the
> > implementation of any of those proposed instances is supposed to be.
> 
> Sure.
[...]
> Hope it's clearer now what I meant.

It's clearer what you meant, but I always assumed that fromEnum and toEnum
must be mutually inverse.  I can't see that law written anywhere in the docs
but it seems to be an almost useless class without that assumption.  The
default implementations of the other methods seems to be completely based on
that assumption, for example:

    http://hackage.haskell.org/package/base-4.11.1.0/docs/src/GHC.Enum.html#Enum


More information about the Haskell-Cafe mailing list