[Haskell-cafe] foreign import and gmp

Lars Kuhtz haskell at kuhtz.eu
Thu Aug 9 00:24:18 CEST 2012

On 8/8/12 2:55 PM, Thomas DuBuisson wrote:
> You need to build GHC using the integer-simple library (instead of the
> 'integer-gmp' library).  From the 6.12.1 release notes:
> """
> It is now possible to build GHC with a simple, BSD-licensed Haskell
> implementation of Integer, instead of the implementation on top of
> GMP. To do so, set INTEGER_LIBRARY to integer-simple in mk/build.mk.
> """

How to I build the Haskell platform in this case? Is it enough to just
use a GHC that was build with INTEGER_LIBRARY=integer-simple in the
build of the platform, or do I need to somehow configure the platform
build to prevent packages from importing integer-gmp?

> In addition, some libraries depend on integer-gmp (sadly).  This is
> usually part of an optimization and when I see it I tend to send in a
> patch adding an "integer-simple" flag so you can cabal install it by
> including "-finteger-simple" on the command line (text is an example
> of one such library).

Does this mean that text does already support this flag?

> And that's it!  Your integer operations will run slower but you should
> get stable operation even when using the GMP library.

What about operations on Integers with small values? Are they still
efficient, i.e. directly mapped to operations on native int? I suppose
that Integers with big values are not very common in the runtime and the
base packages.


More information about the Haskell-Cafe mailing list