DData modules

John Meacham john at repetae.net
Fri Jan 14 21:47:17 EST 2005


On Thu, Jan 13, 2005 at 02:13:08PM +0000, Malcolm Wallace wrote:
> > Also, these modules import Data.Monoid, which contains the non-H98 instance
> > Monoid (a -> a), making it (and these) non-portable.

I'd wrap just that instance in a 
#ifdef _GHC_ 
or actually better,
#ifdef NONLINEAR_INSTANCE_HEADS
.

I have actually written code (already ghc dependent) which counts on
that instance being available. It is quite disasterous to not have
'obvious' instances declared in a common place as then each library
author has to include their own version of said instance making the
libraries unable to be combined without conflicting instances!

to avoid this sort of problem one shouldn't declare instances unless at
least one of 

1. They are writing a standalone program and not a library
2. They declared the class
3. They declared the type they are making an instance

holds.


the gist of all this is we should make sure every 'sensible' instance
for everything declared in the libraries is made for standard types to
avoid encouraging this type of collision.
        John




-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Libraries mailing list