Lazy v. Yield: Incremental, linear pretty-printing

Oleg Kiselyov, Simon Peyton-Jones, Amr Sabry

Research output: Chapter in Book/Report/Conference proceedingConference contribution

5 Citations (Scopus)


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.

Original languageEnglish
Title of host publicationProgramming Languages and Systems - 10th Asian Symposium, APLAS 2012, Proceedings
Number of pages17
Publication statusPublished - 2012
Externally publishedYes
Event10th Asian Symposium on Programming Languages and Systems, APLAS 2012 - Kyoto, Japan
Duration: 2012 Dec 112012 Dec 13

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume7705 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Other10th Asian Symposium on Programming Languages and Systems, APLAS 2012

ASJC Scopus subject areas

  • Theoretical Computer Science
  • Computer Science(all)


Dive into the research topics of 'Lazy v. Yield: Incremental, linear pretty-printing'. Together they form a unique fingerprint.

Cite this