|
ABSTRACT
There are several purely functional libraries for converting tree structured data into indented text, but they all make use of some backtracking. Over twenty years ago, Oppen published a more efficient imperative implementation of a pretty printer. This article shows that the same efficiency is also obtainable without destructive updates by developing a similar but purely functional Haskell implementation with the same complexity bounds. At its heart lie two lazy double ended queues.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Azero, P. and Swierstra, D. 1998. Optimal pretty-printing combinators. http://www.cs.uu.nl/groups/ST/Center/SoftwareDistributions.
|
| |
2
|
Bird, R. S. 1984. Using circular programs to eliminate multiple traversals of data. Acta Inf. 21, 239--250.
|
| |
3
|
|
| |
4
|
|
| |
5
|
|
 |
6
|
|
 |
7
|
|
| |
8
|
Peyton Jones, S. L. 1997. A pretty printer library in Haskell. Part of the GHC distribution at http://www.haskell.org/ghc.
|
| |
9
|
Peyton Jones, S. L., Ed. 2003. Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press.
|
| |
10
|
Wadler, P. 2003. A prettier printer. In The Fun of Programming. Palgrave Macmillan, Chapter 11, 223--244.
|
|