
On 09/28/2016 04:05 AM, Todd Wilson wrote:
Why is the type of divMod not
(Integral a, Integral b) => a -> b -> (a,b)?
It would seem to make sense that if b is a size-limited Integral type (like Int), then since the remainder of a division is always smaller than the divisor, it could be given the same size-limited type.
The absolute value of the remainder of a division is always smaller than the absolute value of the divisor, right? -- Similar reasoning could be transferred to mod. I don't know why it isn't as you suggested. However, I find the current way simpler and easier to understand. If someone knows why we have [divMod :: a -> a -> (a, a)], please comment on it. -- Bernardo Sulzbach http://www.mafagafogigante.org/ mafagafogigante@mafagafogigante.org