#ifdef considered harmful

Sven Panne Sven.Panne at aedion.de
Tue Apr 6 18:24:05 EDT 2004


Graham Klyne wrote:
> Please, no #ifdef's in standard library code! [...]

You're totally right, and I wouldn't propose this under normal circumstances,
but in this special case it would be harmless: The #ifdefs would only exclude
the import of Data.Monoid and a few instances of Monoid. So we have two cases
to consider:

   a) The Haskell system in question supports Data.Monoid, so nothing would be
      excluded and all is well as before.

   b) Data.Monoid is not supported, so having no instances for Monoid would be
      a rather void statement here. :-)

Either way, Ross has proposed a tiny change to make Data.Monoid portable, which
would avoid the #ifdef problem altogether.

Cheers,
    S.



More information about the Libraries mailing list