Transformation in a Non-Strict Language: An Approach to Instantiation

A problem arises when the usual rules of fold/unfold transformation are applied in a non-strict programming system. Case analysis by instantiation may alter strictness characteristics of the function being transformed, and hence alter the behaviour of programs. Although such behavioural changes can in general be quite subtle, they are all too apparent if the program is interactive, since I/O interleaving is closely tied to strictness properties. A two-phase solution to the problem is proposed. It comprises a suitable form of strictness analysis to determine whether a proposed instantiation is safe, and a procedure to re-formulate troublesome definitions so that, in effect, case analysis is shifted to a nearby safe context.