Tue, 25 Apr 2000 15:45:04 +0400 (MSD), S.D.Mechveliani <[EMAIL PROTECTED]> pisze:
> I meant - to derive all the instances the user listed in the
> declaration
> newtype ... deriving( class1, class2 ... ),
> and enabling the user to include in this list the user classes, not
> only the standard ones.
I'll repeat. There are two ways a deriving Show could be interpreted
for a newtype:
- as currently, producing "N 5";
- according to proposed general rules of deiving classes for newtypes,
producing "5".
Unfortunately they don't give the same result, so rules will have to
be inconsistent.
Which meaning of deriving Show would you choose? If the first, then
the new rule becomes "any class can be derived for newtypes giving
such-and-such effect, except Show and Read which are processed as in
Haskell98". If the second, the old rule has to be changed to include
"among Haskell98's derivable classes, Show and Read apply only to data,
not to newtype".
In any case there is an exception of a rule. Explicit exceptions
are bad.
The problem does not arise for other classes, because they give the
same result according to both old and new deriving rules. Overlapping
rules are perfectly OK as long as they give the same result, but
not otherwise.
> I am not sure now, that this can be automatically arranged.
So in <[EMAIL PROTECTED]> I proposed converting
only functions, tuples, and lists. It's not a pretty rule, but the
whole deriving is not pretty already, and it covers most cases in
practice, while being safe.
IMHO the only remaining problem is Read and Show.
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-