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

Brandon Allbery allbery.b at gmail.com
Thu Jun 21 19:15:50 CEST 2012

On Thu, Jun 21, 2012 at 5:11 AM, Rouan van Dalen <rvdalen at yahoo.co.uk>wrote:

> Can anyone shed some light on why the succ and pred functions of the Enum
> typeclass throw
> exceptions if we go over the upper or lower boundary, and not return Maybe
> a?

Enum and Bounded have a complicated and arguably incorrect[1] relationship.
 The whole thing should be overhauled, but this would break quite a lot of
code, so is not likely to happen.

[1] http://www.haskell.org/pipermail/haskell-cafe/2011-September/095431.htmlff.

brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120621/3a1a7c17/attachment.htm>

More information about the Haskell-Cafe mailing list