[Haskell-cafe] Positive integers

Burton Samograd kruhft at gmail.com
Mon Mar 27 11:04:10 EST 2006

> For example, take UNIX nice levels -20 to 19.  You could have
>   data ConstrainedInteger = CI {distToMax :: Natural, distToMin :: Natural}
> this would ensure only the 40 integers can be represented.
> Then you could have _something_ that defined what happened on overflow,
> whether it wraps, reflects, errors, truncates or whatever.

Doesn't Ada have constrained number types which have similar behaviour?

burton samograd                                                kruhft at gmail.com
kruhft.blogspot.com   www.myspace.com/kruhft   metashell.blogspot.com

More information about the Haskell-Cafe mailing list