We propose a programming style for incremental stream processing based on typed simple generators. It promotes modularity and decoupling of producers and consumers just like lazy evaluation. Simple generators, however, expose the implicit suspension and resumption inherent in lazy evaluation as computational effects, and hence are robust in the presence of other effects. Simple generators let us accurately reason about memory consumption. To substantiate our claims we give a new solution to the notorious pretty-printing problem. Like earlier solutions, it is linear, backtracking-free and with bounded latency. It is also simpler to write and reason about, and is compatible with effects including IO, letting us read the source document from a file, and format it as we read. © Springer-Verlag Berlin Heidelberg 2012.
CITATION STYLE
Kiselyov, O., Peyton-Jones, S., & Sabry, A. (2012). Lazy v. Yield: Incremental, linear pretty-printing. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 7705 LNCS, pp. 190–206). https://doi.org/10.1007/978-3-642-35182-2_14
Mendeley helps you to discover research relevant for your work.