On Apr 4, 2006, at 12:46 PM, Twan van Laarhoven 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.
The obvious solution is to allow out-of-defining-module deriving only
for data types where all constructors are exported. Presumably, if
someone explicitly hid (at least some of) the constructors of a data
type, they did it for a reason and we can hope that they carefully
considered the external interface of that type (including instances).
Rob Dockins
Speak softly and drive a Sherman tank.
Laugh hard; it's a long way to the bank.
-- TMBG
_______________________________________________
Haskell-prime mailing list
[email protected]
http://haskell.org/mailman/listinfo/haskell-prime