Skip to main content
Article thumbnail
Location of Repository

Linear, bounded, functional pretty-printing

By S. Doaitse Swierstra and Olaf Chitil


We present two implementations of Oppen's pretty-printing algorithm in Haskell that meet the efficiency of Oppen's imperative solution but have a simpler, clear structure. We start with an implementation that uses lazy evaluation to simulate two co-operating processes. Then we present an implementation that uses higher-order functions for delimited continuations to simulate co-routines with explicit scheduling

Topics: QA76
Publisher: Cambridge University Press
Year: 2009
OAI identifier:

Suggested articles


  1. (2003). A prettier printer. Pages 223–244 of: Gibbons, Jeremy, & Moor, Oege de (eds), The fun of programming.
  2. (1997). A pretty printer library in Haskell. Part of the GHC distribution at doi
  3. (1999). Designing and implementing combinator languages. Pages 150–206 of: Swierstra, doi
  4. (2004). Linear, online, functional pretty printing (corrected and extended version). doi
  5. (2006). Pretty printing with delimited continuations.
  6. (2001). Pretty printing with lazy dequeues. doi
  7. (2005). Pretty printing with lazy dequeues. Transactions on programming languages and systems doi
  8. (1998). Purely functional data structures. doi
  9. (1995). The Design of a Pretty-printing Library. doi
  10. (1984). Using circular programs to eliminate multiple traversals of data. doi

To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.