[cvs-nhc98] patch applied (hat): Support newtype data constructors
and ~ in -T tracing version.
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Tue Oct 10 07:13:13 EDT 2006
Wed Feb 13 08:03:33 PST 2002 olaf
* Support newtype data constructors and ~ in -T tracing version.
The traced code used to be more strict than it should be in arguments of constructors of newtypes and variables occuring in ~ patterns.
Variables in irrefutable patterns may never be evaluated. Hence these variables need to be treated as let not as lambda bound.
Now before actual trace transformation replace every irrefutable pattern in a refutable pattern by a new variable and add an appropriate pattern binding. This leads to a tracing program with the original strictness. The created trace is basically right, except that the newly introduced variable appears in the trace. This is because I reused the normal transformation of pattern bindings; to obtain the desired trace special handling would be necessary. Then change from lambda to let-bound variables is a bit of a hack.
Still need to do something similar in the portable version.
Example program that did not work before:
newtype Seq a = Seq ([a] -> [a])
(+++) :: Seq a -> Seq a -> Seq a
(Seq fxs) +++ (Seq fys) = Seq (fxs . fys)
left (Seq fxs) = head (fxs [])
main = print (left (Seq (True:) +++ undefined))
M ./src/compiler98/DbgTrans.hs -58 +147
M ./src/compiler98/Info.hs -1 +1
More information about the Cvs-nhc98
mailing list