Question about negative Integers

Herbert Valerio Riedel hvriedel at gmail.com
Fri Nov 15 17:19:38 UTC 2019


On Fri, Nov 15, 2019 at 5:04 PM Sylvain Henry <sylvain at haskus.fr> wrote:

> Question is: do we need/want to keep this behavior?


Yes ;-)

I chose it quite intentionally after benchmarking and carefully examining
various approaches, and with the intent to use a common-denominator
representation which would be easy to supplement with alternative bignum
implementations.

Since you didn't seem to reference it, I wonder if you even saw the page
where some of my design rationale was written down as well as hinting at
how I intended to make the backend selectable via a link-time flag (similar
to how you'd select the RTS via -threaded or -prof, you'd also be able to
select the integer backend at link-time w/o the need to recompile
anything). See

https://gitlab.haskell.org/ghc/ghc/wikis/design/integer-gmp2

However, some time ago I did discuss picking up that plan again, but he did
point out that it would make a lot more sense to leverage Backpack for
this, as it seems to be a much more elegant solution to this problem than
the simple but platform-specific link-time approach I was aiming for. Ben
put it quite bluntly that if Backpack can't be used for this thing it was
basically designed for, we should consider ripping it out again as it would
have effectively failed its promise.

And I do agree! Back when I originally redesigned and rewrote integer-gmp
from scratch, Backpack wasn't available yet. But now we have it, and a
Backpack based solution would IMO indeed be the proper solution at this
point to the problem of abstracting over integer-backends as well as
representations -- it could even be combined with my original plan for C
FFI based platforms (but that's mostly an optimization at that point for
the special case where the backends share said common representation at the
ABI level).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20191115/3b3a82ab/attachment.html>


More information about the ghc-devs mailing list