Proposal for stand-alone deriving declarations?

John Meacham john at repetae.net
Wed Nov 1 18:51:57 EST 2006


On Wed, Nov 01, 2006 at 03:15:38PM -0600, Brian Smith wrote:
> How an instance is defined (explicitly or derived) should have nothing to do
> with how it is imported/exported in a module.
> 
> In particular, I think having features like :
>     import M1 hiding (instance C T)
> and
>    module M hiding (instance C T)
> would eliminate the need for special-case handling of derived instances (if
> two imported modules happen to derive the same instances, you can just hide
> the instances from one of them). Instance hiding is an important feature in
> its own right.

selective importing and exporting of instances is a really tricky
technical issue for a lot of reasons, and a bad idea for many others.
For a quick example, imagine a Set created with some operations using
one Ord instance and other operations using another. the globalness of
instance declarations is a great tool.

Fortunately, newtype deriving (hopefully extended as I have mentioned on
this thread) and rank-n polymorphism make it pretty much unneeded.

        John

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


More information about the Haskell-prime mailing list