| I just noticed some unexpected consequences of the way newtype deriving
| is implemented in GHC. Because the dictionary of the underlying type is
| reused, so are base classes. This message is a literate Haskell program
| illustrating the problem.

Excellent point.

| As a solution I would suggest that newtype deriving a class instance is
| only allowed if all base classes instances are also derived using
| newtype deriving. This presents problems for Show and Read, because they
| cannot be derived in that way. It will, however, catch problems with
| most other classes.

Yes, I think you are right.  I'll make a Trac bug report for it; but I think 
I'll fix it in the HEAD only.

S
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to