[cvs-nhc98] Implemented correct matching of newtype data constructors
User olaf
olaf@sparud.net
Fri, 1 Mar 2002 15:04:54 +0100 (CET)
olaf: Fri Mar 1 15:04:54 CET 2002
Update of /usr/src/master/nhc/src/compiler98
In directory hinken:/tmp/cvs-serv19814/src/compiler98
Modified Files:
AuxFile.hs AuxFixity.hs AuxLabelAST.hs Makefile
PrettySyntax.hs TraceId.hs TraceTrans.hs
Added Files:
AuxTypes.hs
Log Message:
Implemented correct matching of newtype data constructors and ~ in portable transformation.
The main work is actually done by auxLabelSyntaxTree. The same variable can now appear both as a let and a lambda bound variant (hence they need different prefixes in the transformation). All variables in pattern are considered as lambda bound (however, for simplicity auxLabelSyntaxTree may mark some as let bound). For a variable x occurring in an irrefutable pattern, auxLabelSyntaxTree adds an equation x = x to the syntax tree, where the lhs is let bound and the rhs is lambda bound. All usages of x will use the let bound variant. The normal transformation of the equation x = x will assure that x always has a trace, even if it is never demanded.
To avoid recursive modules the module AuxTypes had to be created.
Needed to extend the .hx format slightly to record if a data constructor belongs to a newtype or a data type. Hence all libraries including prelude need to be retransformed.
Now distinguish between lambda bound variables and let bound variables with arity 0.
Corrected a bug: A single let-bound variable on a rhs should not be surrounded by an indirection. It is not a projection.