Building GHC 5.02 on Solaris x86

Simon Marlow simonmar at microsoft.com
Mon Nov 5 10:08:46 EST 2001


> > So, bringing back the solution of having manually written C wrapper
> > functions which platform-independent Haskell source files will call
> > out to, would be preferable (in short, avoid the use of hsc2hs *or
> > any other extra tool* alltogether). I'm willing to make the
> > necessary changes.
> 
> You started by objecting to using a tool that commits your code to a
> platform too early.  I'm in complete agreement.
> 
> But now you seem to be objecting to using any tools at all.  
> This seems
> excessive.  Why not do one of:
> 
> 1) Don't write the tool in Haskell
> 
> 2) Write in Haskell but execute it using a more easily ported Haskell
>    implementation (i.e., Hugs or NHC)
> 
> 3) Write it in Haskell but include platform independent machine 
>    generated code in the distributions.
> 
> [I lean towards 3 since it avoids the embarressment of 1 and 2]
> 
> (This is all on the assumption that the amount of code we're talking
> about is significant enough to care.  I have the impression that it is
> but could be wrong.)

In this case, tool-dependency isn't an issue, because the tool can be
generated from the same set of prerequisites that you already require to
build the libraries, namely working Haskell & C compilers.

It isn't the tool itself that is the problem - it is the baking of
OS-dependent information into the Haskell source that is causing
problems, because this means that our previously mostly OS-independent
intermediate C files are now OS-dependent.  The OS-independent nature of
the intermediate C is a fairly fragile property - it requires you to
avoid using any OS-related #ifdef in the Haskell source, and it means
our Haskell-to-C translation must be entirely OS-independent, but the
property is highly useful when porting to a new OS.

To achieve full platform-independence you also have to not use any
architecture-related #ifdefs in the Haskell source (we don't do this:
there are quite a few 32-vs-64 bit dependencies in there, which made
porting to the Alpha recently *interesting* I understand :-).

Cheers,
	Simon




More information about the Glasgow-haskell-bugs mailing list