Ross Paterson wrote:
> On Fri, Aug 15, 2008 at 02:21:33PM +0200, Sean Leather wrote:
> > In my case, it does matter where instances are in scope. My library
> > requires orphan instances by design. If the programmer imports the
> > top-level module, then s/he gets a default set of instances. But the
> > programmer has the option to import select modules and get a different
> > set of classes and instances.
>> With implicit import, it just doesn't work to have different instances in
> different places. Suppose two modules use your library in the different
> ways you envisage. Then those modules cannot be used together in the
> same program. Your library will not be re-usable.
>
It is not true that those modules cannot be used in the same program. It is
possibly true that they cannot both be imported by another module. (It
depends on how the instances are used.)
The issue is not that the library is not re-usable. It's simply a trade-off.
One use of the library (the default) allows for simplicity. The second use
allows for extensibility and specialization. The latter requires more work,
but it is possible.
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20080815/d982de63/attachment.htm