'deriving Tree (Eq,Ord)'

Benjamin Franksen benjamin.franksen at bessy.de
Tue Apr 4 13:11:04 EDT 2006


On Tuesday 04 April 2006 18:46, you wrote:
> Benjamin Franksen wrote:
> > However, it would help programmers a lot, specialy library users.
> > And it would lift some of the burden that is currently on the
> > library writer to never forget to derive all possibly useful
> > instances for public data types.
>
> If you allow 'deriving' in other modules it can violate the 'privacy'
> of modules. For example (if these instances were not declared):
> deriving Data.Map.Map (Show)
>
> Now I can look at what map nodes look like.
>
>  > deriving Data.Map.Map (Data)
>
> Now I can even mess with the internal structure, violating
> invariants.

Ouch! This would be bad. Hmm... not all exported data types are 
abstract. I guess we could allow it for data types with no hidden 
constructors, but then maybe it is not quite as useful as I thought...

Ben


More information about the Haskell-prime mailing list