Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

A pretty but not greedy printer (functional pearl)

Published: 29 August 2017 Publication History

Abstract

This paper proposes a new specification of pretty printing which is stronger than the state of the art: we require the output to be the shortest possible, and we also offer the ability to align sub-documents at will. We argue that our specification precludes a greedy implementation. Yet, we provide an implementation which behaves linearly in the size of the output. The derivation of the implementation demonstrates functional programming methodology.

References

[1]
Pablo R. Azero and S. Doaitse Swierstra. 1998. Optimal Pretty Printing Combinators. (1998). Submitted to ICFP 1998.
[2]
Richard Bird and Oege de Moor. 1997. Algebra of programming. Prentice-Hall, Inc. http://portal.acm.org/citation.cfm?id= 248932
[3]
Kalyanmoy Deb, Karthik Sindhya, and Jussi Hakanen. 2016. Multi-objective optimization. In Decision Sciences: Theory and Practice. CRC Press, 145–184.
[4]
John Hughes. 1995. The Design of a Pretty-printing Library. In Advanced Functional Programming, First International Spring School on Advanced Functional Programming Techniques-Tutorial Text. Springer-Verlag, 53–96. http://portal.acm.org/ citation.cfm?id=734154
[5]
Conor McBride and Ross Paterson. 2007. Applicative programming with effects. Journal of Functional Programming 18, 01 (2007), 1–13.
[6]
Anton Podkopaev and Dmitri Boulytchev. 2014. Polynomial-Time Optimal Pretty-Printing Combinators with Choice. In Perspectives of System Informatics - 9th International Ershov Informatics Conference, PSI 2014, St. Petersburg, Russia, June 24-27, 2014. Revised Selected Papers. 257–265.
[7]
S. Doaitse Swierstra and Olaf Chitil. 2009. Linear, bounded, functional pretty-printing. Journal of Functional Programming 19, 01 (2009), 1–16.
[8]
Philip Wadler. 1987. A critique of Abelson and Sussman or why calculating is better than scheming. ACM SIGPLAN Notices 22, 3 (1987), 83–94.
[9]
Philip Wadler. 2003. A prettier printer. Palgrave MacMillan, 223–243.

Cited By

View all
  • (2023)A Pretty Expressive PrinterProceedings of the ACM on Programming Languages10.1145/36228377:OOPSLA2(1122-1149)Online publication date: 16-Oct-2023
  • (2021)Filling typed holes with live GUIsProceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3453483.3454059(511-525)Online publication date: 19-Jun-2021
  • (2018)FliPpr: A System for Deriving Parsers from Pretty-PrintersNew Generation Computing10.1007/s00354-018-0033-736:3(173-202)Online publication date: 27-Aug-2018

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 1, Issue ICFP
September 2017
1173 pages
EISSN:2475-1421
DOI:10.1145/3136534
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 29 August 2017
Published in PACMPL Volume 1, Issue ICFP

Permissions

Request permissions for this article.

Check for updates

Author Tag

  1. Pretty printing

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)123
  • Downloads (Last 6 weeks)16
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2023)A Pretty Expressive PrinterProceedings of the ACM on Programming Languages10.1145/36228377:OOPSLA2(1122-1149)Online publication date: 16-Oct-2023
  • (2021)Filling typed holes with live GUIsProceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3453483.3454059(511-525)Online publication date: 19-Jun-2021
  • (2018)FliPpr: A System for Deriving Parsers from Pretty-PrintersNew Generation Computing10.1007/s00354-018-0033-736:3(173-202)Online publication date: 27-Aug-2018

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media