Deprecating fromIntegral

Niklas Hamb├╝chen mail at nh2.me
Thu Sep 21 23:19:49 UTC 2017


On 21/09/17 19:27, Evan Laforge wrote:
> If I were to suddenly get 10,000 lines of warnings...

If the built tool is set up sensibly (perhaps we should make it so if
that is not already possible, but I think these days warnings of
dependency packages are omitted anyway, as cabal and stack build them in
parallel), you should get (and care about and fix) only warnings about
those occurrences that are in the packages you maintain / build directly.

You are unlikely to get 10,000 warnings:

I've made a quick histogram over all of Hackage (note, this includes
lots of abanoned code)


https://gist.github.com/nh2/f45d628a81c04f95e14f14ea37d33b22#file-fromintegral-uses-png

There is also a JSON file containing counts for each packet so that you
can quickly look up how many occurrences your packages have.

Most packages have < 3 occurrences of fromIntegral, a few have < 20
occurrences. Very few have more than 20.

Assuming we go for a naming improvement and add 3 functions ala
maybeFromInteger / runtimeCheckedFromInteger / fromIntegerWrap, a
package owner would have to step through their deprecation warnings and
replace each with one of the new 3 functions to get their package
warning-free.

I estimate this to be a very minor task/effort compared to the major
changes GHC Haskell has gone through in the last years.

I could probably already have fixed 1000 of the 7000 total occurrences
on Hackage myself within the time it as taken me to debug integer
conversion related problems in GHC/base in the last week.

(In other words, these changes are cheap and have high payoff.)


More information about the Libraries mailing list