'deriving Tree (Eq,Ord)'

Twan van Laarhoven twanvl at gmail.com
Tue Apr 4 12:46:18 EDT 2006

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.


More information about the Haskell-prime mailing list