In this paper we present a model of interactive programs in a purely
functional style. We exploit lazy evaluation in the modelling of streams
as lazy lists. We show how programs may be constructed in an ad hoc
way, and then present a small set of interactions and combinators which
form the basis for a disciplined approach to writing such programs.
One of the difficulties of the ad hoc approach is that the way in which
input and output are interleaved by the functions can be unpredictable.
In the second half of the paper we use traces, i.e. partial histories of
behaviour, to explain the interleaving of input and output, and give a
formal explanation of our combinators. We argue that this justifies our
claim that the combinators have the intuitively expected behaviour, and
finally contrast our approach with another.
[1]
Robert Cartwright,et al.
The semantics of lazy (and industrious) evaluation
,
1982,
LFP '82.
[2]
John H. Williams,et al.
Sacrificing simplicity for convenience: Where do you draw the line?
,
1988,
POPL '88.
[3]
Amir Pnueli,et al.
Applications of Temporal Logic to the Specification and Verification of Reactive Systems: A Survey of Current Trends
,
1986,
Current Trends in Concurrency.
[4]
C. A. R. Hoare,et al.
Communicating sequential processes
,
1978,
CACM.
[5]
D. A. Turner,et al.
Miranda: A Non-Strict Functional language with Polymorphic Types
,
1985,
FPCA.