Deprecating fromIntegral

Niklas Hamb├╝chen mail at
Thu Sep 21 13:10:44 UTC 2017

Also, just to make that clear, the purpose here is not to to remove a
function that does something useful without providing a replacement.

It is to make sure that functions have appropriate names for what they
do, so that you don't use a function accidentally that has different
behaviour from what you expect.

For example, in the use of `ready` in GHC's Handle code

the author certainly did not intend to have any wrapping behaviour, but
nothing in that code looks wrong unless you think really, really hard.

Because it looks correct.

(And has looked correct for 17 years:

If you wanted wrapping behaviour, a `wrapIntegral` would be your friend.

If a `wrapIntegral` is used in a place that shouldn't have it, that gets
noticed immediately in review.

On 21/09/17 14:53, Niklas Hamb├╝chen wrote:
> On 21/09/17 14:35, amindfv at wrote:
>> I'm -1 on this (there are lots of places where you need to know the bounds of the numeric type you're using)
> I don't quite understand what you mean with "you need to know the
> bounds", or what role `fromIntegral` has in that, can you elaborate?

More information about the Libraries mailing list