
| There has been a suggestion that the 'deriving' mechanism be de-coupled | from the datatype declaration. Together with a generic default | definition, that means you could write something like | | deriving Bin for (,,,,,,,,,,,,,,,,,,,,) | | and hence not need to write the tedious instance header yourself, | since the compiler can easily infer it. Yes -- a couple of times I've nearly gotten down to implementing this. Given that we have the deriving mechanism at all, we might as well make it a bit more useful. The only real obstacle is defining a suitable syntax. It makes the language bigger, but not in a deep way. Simon

Hello Simon, Thursday, February 09, 2006, 11:19:00 AM, you wrote: SPJ> | deriving Bin for (,,,,,,,,,,,,,,,,,,,,) SPJ> Yes -- a couple of times I've nearly gotten down to implementing this. it is a real and well-known problem - that, for example, user of library can't derive "Show" or "Eq" instance for datatypes defined in this library. on the other side, usual "derivibg" clauses should be able to use generic definitions, such as this for Binary class -- Best regards, Bulat mailto:bulatz@HotPOP.com
participants (2)
-
Bulat Ziganshin
-
Simon Peyton-Jones