[Haskell-cafe] Why does Enum succ and pred functions throw exception

Alexander Solla alex.solla at gmail.com
Fri Jun 22 21:40:33 CEST 2012

On Thu, Jun 21, 2012 at 5:36 PM, Richard O'Keefe <ok at cs.otago.ac.nz> wrote:

It always struck me as odd that Enum doesn't extend Ord.
> There's a reason given for not having Bounded extend Ord,
> which doesn't really apply to a class having fromEnum :: a -> Int.
> Testing whether an enum bound is at a limit is thus a bit tricky.

An ordering does not typically induce a computable enumeration.  For
example, there are infinitely many rationals between any pair of rationals.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120622/d294a858/attachment.htm>

More information about the Haskell-Cafe mailing list