RE: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-22 Thread Simon Peyton-Jones
|  I know this is a sensitive issue and I absolutely don't want to start any
|  kind of discussion about the merits or otherwise of LGPL, but I was
|  wondering if there are any plans to remove the GNU mp library from the
|  runtime so that it would be possible to distribute native executables
|  compiled with GHC without having to deal with the additional issues raised
|  by the current inclusion of this LGPL component in the runtime. (Afaik
|  everything else in ghc is under a BSD3 license.)
|
| There is an interest in removing GMP, motivated partly by licensing but
| also due to portabiltity concerns and the fact that the use of GHC's
| memory manager in GMP prevents FFI code from using GMP safely.
|
| http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes

Just to summarise our position at GHC HQ on this question:

* We don't much like bundling GMP either.  But it works and it's fast.

* We'd be very happy to have others work on a replacement
(a) using a another C library
(b) using a Haskell library

* Another alternative (c) to be able to build GHC two ways,
- with GMP (fast, but with GMP)
- with a Haskell library instead (probably slower
but no GMP)
  Or perhaps arrange that GHC can generate code either
  assuming GMP or not assuming GMP (i.e. one compiler with
  a flag).   BUT it's fiddly and painful to implement and
  maintain two paths.

* To replace GMP altogether we'd need to be convinced that
  we would not lose much performance.

* There are one or two arbitrary precision libraries in Haskell
  eg http://www.haskell.org/pipermail/libraries/2007-August/007909.html

* Peter Tanksi did quite a lot of work on (a), but we're not
  sure how far he's got. The Wiki link above is his work.
  Thanks Peter!

* This is a fiddly topic.  GMP is connected to GHC in an unusually
  intimate way (because it allocates in GHC's heap).  Care needed.

In short, we just don't have the bandwidth to tackle this, but
would be happy to help others who would like to. Although fiddly,
it's a very clear topic for a project.

Simon
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-22 Thread Stefan O'Rear
On Wed, Aug 22, 2007 at 10:32:36AM +0100, Simon Peyton-Jones wrote:
 | There is an interest in removing GMP, motivated partly by licensing but
 | also due to portabiltity concerns and the fact that the use of GHC's
 | memory manager in GMP prevents FFI code from using GMP safely.
 |
 | http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes
 
 Just to summarise our position at GHC HQ on this question:


 * We don't much like bundling GMP either.  But it works and it's fast.
...
 * We'd be very happy to have others work on a replacement
 (a) using a another C library
 (b) using a Haskell library
...
 * To replace GMP altogether we'd need to be convinced that
   we would not lose much performance.
...
 * There are one or two arbitrary precision libraries in Haskell
   eg http://www.haskell.org/pipermail/libraries/2007-August/007909.html

Another possibility that occured to me recently, is to switch Integer
to a simpler (perhaps even pure-Haskell) representation, and provide
(core?  extra?  Hackage?) a hsgmp package.  If you have big numbers,
switching is easy:

import Prelude hiding(Integer)
import Data.Integer.GMP
type Integer = MPZ

Stefan


signature.asc
Description: Digital signature
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-22 Thread Isaac Dupree

Stefan O'Rear wrote:

Another possibility that occured to me recently, is to switch Integer
to a simpler (perhaps even pure-Haskell) representation, and provide
(core?  extra?  Hackage?) a hsgmp package.  If you have big numbers,
switching is easy:

import Prelude hiding(Integer)
import Data.Integer.GMP
type Integer = MPZ


except that lots of things depend on Prelude.Integer, such as class Num 
and Integral, potentially a fixed Enum, and who knows what functions 
that base exports.  IMO there needs to be a standard Integer type for 
library APIs to use (unless making them all class-qualified like 
(Integral a) = is an acceptable substitute?).  This does not fit well 
with different code using different Integers as they please, especially 
not if we want it to be likely/possible to be fast.


Isaac
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-22 Thread Isaac Dupree

Isaac Dupree wrote:

Stefan O'Rear wrote:

Another possibility that occured to me recently, is to switch Integer
to a simpler (perhaps even pure-Haskell) representation, and provide
(core?  extra?  Hackage?) a hsgmp package.  If you have big numbers,
switching is easy:

import Prelude hiding(Integer)
import Data.Integer.GMP
type Integer = MPZ


except that


you also need to add default (Integer, Double) or similar.

and Int is rather machine-dependent and could be implemented in 
Haskell, too.  I definitely don't want programs using Int instead of 
Integer just because of Int being more standard and consistent.


Isaac
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-16 Thread Duncan Coutts
On Wed, 2007-08-15 at 18:41 +0100, Brian Hulley wrote:
 Hi,
 I know this is a sensitive issue and I absolutely don't want to start 
 any kind of discussion about the merits or otherwise of LGPL, but I was 
 wondering if there are any plans to remove the GNU mp library from the 
 runtime so that it would be possible to distribute native executables 
 compiled with GHC without having to deal with the additional issues 
 raised by the current inclusion of this LGPL component in the runtime. 
 (Afaik everything else in ghc is under a BSD3 license.)
 
 It's less of an issue on Linux where libgmp is dynamically linked but 
 when thinking about using Haskell ghc for creating Windows apps it is 
 for me a real problem,

Sounds to me like the simlest solution for you would be if GHC could use
a dynamically linked gmp.dll on Windows. That also sounds like much less
work that replacing gmp completely.

Has anyone tried this?

Duncan

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-16 Thread Brian Hulley

Stefan O'Rear wrote:

On Wed, Aug 15, 2007 at 06:41:53PM +0100, Brian Hulley wrote:
  
... I was 
wondering if there are any plans to remove the GNU mp library from the 
runtime

... http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes
  

Thanks for the link.
... although the program 
includes code that is libre/gratis free the program is not itself free etc 
etc...



Huh? ...


I meant if you are distributing a proprietary program then you have the 
problem of trying to explain to an end-user all the intricacies involved 
with the LGPL without conveying the impression that the whole program is 
free. My impression is that someone who doesn't know anything about 
programming might have a hard time understanding the LGPL correctly.



Ian Lynagh wrote:

I'll be looking at making it optional once 6.8.1 is out of the way, but
you will need to use a GHC compiled with an alternative; you won't be
able to make a non-GMP program with a GMP GHC.
  

Thanks, that's good news.
Perhaps one option for the non-GMP version of GHC would be to have a 
large integer library written in Haskell itself, since it is useful to 
have large integers even if they are not as fast as those provided by 
GMP (eg when writing a lexer it is useful to have large integers to 
correctly lex integer literals (ie without silently truncating them to 
the capacity of an Int) but speed here is not that important).
To get high speed for stuff in external libs, perhaps some way of 
extending the foreign interface to allow direct access to the Haskell 
heap instead of always having to copy via the C heap, would be useful.



Duncan Coutts wrote:

Sounds to me like the simlest solution for you would be if GHC could use
a dynamically linked gmp.dll on Windows. That also sounds like much less
work that replacing gmp completely.
This would certainly make things easier though it doesn't solve every 
problem. For example, the LGPL requires you to give permission to people 
to reverse engineer your application, in order for them to be able to 
understand it enough to get it to work with an updated version of the 
LGPL component. Although this is perfectly reasonable imho, it leaves me 
with a problem if my application also needs to make use of eg Microsoft 
runtime components or third party proprietary statically linked 
libraries since there are parts of my program binary for which I do not 
have the authority to grant permission to reverse engineer thus it may 
not even be possible for me to comply with the terms of the LGPL.


Of course I am not a lawyer so I may have got this wrong, but since I 
can't possibly afford to hire a lawyer to look into all of this I have 
to play it safe and therefore would prefer to avoid any use of LGPL 
components in a proprietary app.


Thanks also to everyone else who replied,

Brian.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-16 Thread Duncan Coutts
On Thu, 2007-08-16 at 14:22 +0100, Brian Hulley wrote:

  Sounds to me like the simlest solution for you would be if GHC could use
  a dynamically linked gmp.dll on Windows. That also sounds like much less
  work that replacing gmp completely.
 This would certainly make things easier though it doesn't solve every 
 problem. For example, the LGPL requires you to give permission to people 
 to reverse engineer your application, in order for them to be able to 
 understand it enough to get it to work with an updated version of the 
 LGPL component. Although this is perfectly reasonable imho, it leaves me 
 with a problem if my application also needs to make use of eg Microsoft 
 runtime components or third party proprietary statically linked 
 libraries since there are parts of my program binary for which I do not 
 have the authority to grant permission to reverse engineer thus it may 
 not even be possible for me to comply with the terms of the LGPL.

From the LGPL v3:

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and
reverse engineering for debugging such modifications, if you
also do each of the following:
[list of stuff you have to do]

So it looks like you only have not restrict reverse engineering for the
purposes of making updated GMP libs work with your program. Since the MS
Runtime components do not interact directly with the GMP at all you
shouldn't need to grant users the right to reverse engineer those
components. Indeed it's only ghc library and rts code that would
interact with gmp.dll.

BTW, I don't think it should be too hard to construct a notice that
indicates that portions of the work are covered by specific copyright
licences, the details of which are available. After all Microsoft have
dozens of these notices for various bits of BSD code they use and nobody
mistakes Windows for Free software.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-16 Thread Brian Hulley

Duncan Coutts wrote:

On Thu, 2007-08-16 at 14:22 +0100, Brian Hulley wrote:
.. For example, the LGPL requires you to give permission to people 
to reverse engineer your application... thus it may 
not even be possible for me to comply with the terms of the LGPL.



From the LGPL v3:

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and
reverse engineering for debugging such modifications, if you
also do each of the following:
[list of stuff you have to do]

So it looks like you only have not restrict reverse engineering for the
purposes of making updated GMP libs work with your program. Since the MS
Runtime components do not interact directly with the GMP at all you
shouldn't need to grant users the right to reverse engineer those
components. Indeed it's only ghc library and rts code that would
interact with gmp.dll.
  


Thanks for suggesting that. It sounds reasonable though I tend to get a 
bit paranoid when it comes to legal things - will the FSF agree with the 
above interpretation etc.

BTW, I don't think it should be too hard to construct a notice that
indicates that portions of the work are covered by specific copyright
licences, the details of which are available. After all Microsoft have
dozens of these notices for various bits of BSD code they use and nobody
mistakes Windows for Free software.


True, but if there's any chance of just getting rid of the GMP 
altogether from a version of GHC there would be no tricky issues when it 
comes to distributing proprietary apps, thus potentially increasing 
GHC's user base, making Haskell more popular, and hopefully leading to 
more BSD3 libs being written by those new users... ;-)


Best regards, Brian.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-15 Thread Brian Hulley

Hi,
I know this is a sensitive issue and I absolutely don't want to start 
any kind of discussion about the merits or otherwise of LGPL, but I was 
wondering if there are any plans to remove the GNU mp library from the 
runtime so that it would be possible to distribute native executables 
compiled with GHC without having to deal with the additional issues 
raised by the current inclusion of this LGPL component in the runtime. 
(Afaik everything else in ghc is under a BSD3 license.)


It's less of an issue on Linux where libgmp is dynamically linked but 
when thinking about using Haskell ghc for creating Windows apps it is 
for me a real problem, because it would mean I'd have to distribute the 
code for my app as a library along with the code as an executable, thus 
doubling the download size for my apps as well as having to include a 
license that has to explain to a possibly non-technical user that 
although the program includes code that is libre/gratis free the program 
is not itself free etc etc...


Regards, Brian.
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-15 Thread Stefan O'Rear
On Wed, Aug 15, 2007 at 06:41:53PM +0100, Brian Hulley wrote:
 Hi,
 I know this is a sensitive issue and I absolutely don't want to start any 
 kind of discussion about the merits or otherwise of LGPL, but I was 
 wondering if there are any plans to remove the GNU mp library from the 
 runtime so that it would be possible to distribute native executables 
 compiled with GHC without having to deal with the additional issues raised 
 by the current inclusion of this LGPL component in the runtime. (Afaik 
 everything else in ghc is under a BSD3 license.)

There is an interest in removing GMP, motivated partly by licensing but
also due to portabiltity concerns and the fact that the use of GHC's
memory manager in GMP prevents FFI code from using GMP safely.

http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes

 It's less of an issue on Linux where libgmp is dynamically linked but when 
 thinking about using Haskell ghc for creating Windows apps it is for me a 
 real problem, because it would mean I'd have to distribute the code for my 
 app as a library along with the code as an executable, thus doubling the 
 download size for my apps as well as having to include a license that has 
 to explain to a possibly non-technical user that although the program 
 includes code that is libre/gratis free the program is not itself free etc 
 etc...

Huh?  AFAIK the LGPL is only an issue for the commercial/proprietary
users of Haskell; gratis/libre works would continue to be gratis/libre
after linking with GMP.

Stefan


signature.asc
Description: Digital signature
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Status of GHC runtime dependency on GNU multi precision arithmetic library

2007-08-15 Thread Ian Lynagh
On Wed, Aug 15, 2007 at 06:41:53PM +0100, Brian Hulley wrote:

 I know this is a sensitive issue and I absolutely don't want to start 
 any kind of discussion about the merits or otherwise of LGPL, but I was 
 wondering if there are any plans to remove the GNU mp library from the 
 runtime

I'll be looking at making it optional once 6.8.1 is out of the way, but
you will need to use a GHC compiled with an alternative; you won't be
able to make a non-GMP program with a GMP GHC.

 (Afaik everything else in ghc is under a BSD3 license.)

Readline isn't, but is already optional, and won't get linked into
programs you write unless you actually use it.


Thanks
Ian

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users