instance visibility

Simon Marlow marlowsd at gmail.com
Fri Sep 26 11:33:14 EDT 2008


Claus Reinke wrote:
>> .. I'm not trying to say that Haskell 98 only supports global 
>> instances, rather I'm saying we should think of it that way and design 
>> our libraries with global instances in mind, because otherwise we have 
>> serious problems with abstraction.
> 
> Thinking of it that way still doesn't make it so. If you want instances
> to be global, you have to change Haskell 98, by propagating instances
> through the whole program.

Sigh.  I'm not having much luck convincing you, so let me try a 
different tack.  Here's a scenario I'd like your opinion on:

We have a test in GHC's test suite called instance-leak, which tests 
that none of the Haskell 98 libraries exports the Functor instance for 
(->).  I broke this test recently by accident.  How did I break it?  By 
using Data.Map internally in System.Process.  The Functor instance for 
(->) is exported from Control.Monad.Instances, makes its way into 
Data.Map, then into System.Process and thereby into System, which is a 
Haskell 98 module.

In your opinion, who or what is at fault for this test failure?  Think 
carefully about the ramifications of your answer.  Oh, and "Haskell 98" 
is not a valid answer, because we can't change that.

Cheers,
	Simon



More information about the Libraries mailing list