
I posted on the bug tracker earlier about doing this and now I am actually attempting it. I went to darcs.haskell.org/packages/ and decided arbitrarily to start with Data.Map, which I copied into the packages/ directory in yhc. When I compile it complains about #if preprocessor statements, which enclose GHC specific code and could be commented out but also there is an #include and what looks like a macro that might actually be important. As I understand it the preprocessor is turned off in yhc (thus the error). As far as I can tell nothing else in packages/ uses preprocessor directives. Possibilities: 1) I should enable -cpp specifically for this file or globally for all of yhc, or just for packages/. (I'm not entirely sure how to get scons to do this but I need to take time and read the scons docs.) 2) I should remove and work around the preprocessor directives. If I start making changes how does yhc keep in sync with any changes that are made to the base packages upstream? 3) It doesn't matter. I should do whatever makes me happy. Please advise. Thanks. --Lane (Submitting this a second time because I snagged the moderation filter the first time.)

Hi Lane,
I posted on the bug tracker earlier about doing this and now I am actually attempting it.
Fantastic!
I went to darcs.haskell.org/packages/ and decided arbitrarily to start with Data.Map, which I copied into the packages/ directory in yhc.
When I did a half attempt at this, I also started with Data.Map. However, that depends on Data.Typeable, which depends on Data.HashTable which depends on virtually every evil bit of Haskell. It was quite hard to find chunks of the base library which aren't intertwined.
As I understand it the preprocessor is turned off in yhc (thus the error).
By default, yes
As far as I can tell nothing else in packages/ uses preprocessor directives.
1) I should enable -cpp specifically for this file or globally for all of yhc, or just for packages/. (I'm not entirely sure how to get scons to do this but I need to take time and read the scons docs.)
I think this is the easiest one to do. I'd enable it for all packages/ in the scons script - compiling the other packages with -cpp is unlikely to be an issue. Andrew can probably advise about the scons side of things.
2) I should remove and work around the preprocessor directives. If I start making changes how does yhc keep in sync with any changes that are made to the base packages upstream?
You are very likely to need to make changes the the base repo, quite possibly substantial changes - often introducing new preprocessor directives etc to cope with Yhc. Integrating these patches back into the base library is definately a priority - once you have something that does something useful (but not necessarily complete by any means) we can contact the libraries@ list and set about getting the patches applied. Thanks Neil

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
1) I should enable -cpp specifically for this file or globally for all of yhc, or just for packages/. (I'm not entirely sure how to get scons to do this but I need to take time and read the scons docs.)
I think this is the easiest one to do. I'd enable it for all packages/ in the scons script - compiling the other packages with -cpp is unlikely to be an issue. Andrew can probably advise about the scons side of things.
I would think that nowadays the appropriate way to specify this is to put {-# LANGUAGE CPP #-} at the beginning of each file that needs it? see http://www.haskell.org/ghc/docs/latest/html/users_guide/pragmas.html#languag... "This allows language extensions to be enabled in a portable way. It is the intention that all Haskell compilers support the LANGUAGE pragma with the same syntax, although not all extensions are supported by all compilers, of course." ... Isaac -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFlQvTHgcxvIWYTTURAsvLAKCev7dfCj2ZPEMWMtDR2eSG69euvACdFVTD KgPNH/5+Efj38niJkOB73jU= =bvga -----END PGP SIGNATURE-----

Hi
I would think that nowadays the appropriate way to specify this is to put {-# LANGUAGE CPP #-} at the beginning of each file that needs it? see http://www.haskell.org/ghc/docs/latest/html/users_guide/pragmas.html#languag... "This allows language extensions to be enabled in a portable way. It is the intention that all Haskell compilers support the LANGUAGE pragma with the same syntax, although not all extensions are supported by all compilers, of course." ...
We have pragmas, so adding that shouldn't be too hard. If someone opens a bug for it, we won't forget. However for the base libraries, we want the minimal set of changes required to the code, to make it easier to get the changes integrated back in. GHC and Hugs both just preprocess all the base package with flags, we should do the same. Personally I think adding pragma's at the top of each file is a much better method, but for the base library if we want to do this we should probably ping libraries@ and see what people think - my guess is most will say no. Thanks Neil
participants (3)
-
Christopher Lane Hinson
-
Isaac Dupree
-
Neil Mitchell