[cvs-nhc98] Implemented deriving mechanism for portable tracing.
User olaf
olaf@sparud.net
Thu, 7 Mar 2002 18:58:16 +0100 (CET)
olaf: Thu Mar 7 18:58:16 CET 2002
Update of /usr/src/master/nhc/src/hat/lib
In directory hinken:/tmp/cvs-serv22528/src/hat/lib
Modified Files:
PreludeBasic.hs
Log Message:
Implemented deriving mechanism for portable tracing.
Restriction: The context of a derived class is not obtained by context reduction as it should be, because that would require reimplementing major parts of type inference and would need access to all visible classes, instances and type synonyms. Instead the canoncial context, i.e. the class applied to every type variable of the instance type, is used. That always works if all instances used by an instance are also derived, and for all "reasonable" user defined ones.
Difference: Show and Read are implemented as outlined in recent mail to Simon, different from implementation used by all Haskell compilers. These instances are far more sensible.
Deriving of Ix has not yet been implemented, because that library does not yet exist.
In PreludeBasic some functions are defined that are used by the derived code. The idea is that all identifiers introduced by the transformation should be imported qualified from PreludeBasic. Even those that are also exported by Prelude, because the user may hide the Prelude (not yet realised for old code).
This extension requires retransformation of the Prelude and its parts.