Deprecating fromIntegral

Carter Schonwald carter.schonwald at gmail.com
Fri Sep 22 11:30:42 UTC 2017


I’m -10 in this proposal

Every time I write a number literal I’ll now get a warning.  Cause as it
hasn’t been remarked : every integer literal uses these operations afaik

The intent / spirit of this proposal is correct, the method of recourse
isn’t.

On Thu, Sep 21, 2017 at 7:20 PM Niklas Hambüchen <mail at nh2.me> wrote:

> 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.)
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170922/e2e2ab47/attachment-0001.html>


More information about the Libraries mailing list