[Add bibliographic info Bryan O'Sullivan **20080312050754] { hunk ./en/bibliography.xml 3 + + + Hughes95 + + JohnHughes + <ulink + url="http://citeseer.ist.psu.edu/hughes95design.html">The + design of a pretty-printing library</ulink> + + + May, 1995 + First International Spring School on Advanced + Functional Programming Techniques +
Bastad, Sweden
+
+
hunk ./en/bibliography.xml 89 + + + Wadler98 + + PhilipWadler + <ulink + url="http://citeseer.ist.psu.edu/wadler98prettier.html">A + prettier printer</ulink> + March 1998 + + hunk ./en/ch06-library.xml 1017 - We can make a number of interesting improvements to our - pretty printer. + Our current pretty printer is spartan to fit within our + space constraints, but there are a number of useful + improvements we can make. hunk ./en/ch06-library.xml 1022 + + + Write a function, fill: + + &Prettify.hs:fill; + + It should render the document, then add spaces so + that the rendered text is the given number of columns + wide. If the text is already wider than this value, it + should add no spaces. + + + hunk ./en/ch06-library.xml 1053 + hunk ./en/ch06-library.xml 1055 - - Practical pointers, and further reading + + Practical pointers, and further reading hunk ./en/ch06-library.xml 1058 - Blah. - + &GHC; already bundles a pretty printing library, + Text.PrettyPrint.HughesPJ. It provides the same + basic API as our example, but a much richer and more useful set + of pretty printing functions. We recommend using it, rather + than writing your own. + + The design of the HughesPJ pretty printer was + introduced by John Hughes in . The library was + subsequently improved by Simon Peyton Jones, hence the name. + Hughes's paper is long, but well worth reading for his + discussion of how to design a library in Haskell. + + In this chapter, our pretty printing library is based on a + simpler model described in . His library was + extended by Daan Leijen; this version is available for download + from Hackage. hunk ./examples/ch06/Prettify.hs 153 + +{-- snippet fill --} +fill :: Int -> Doc -> Doc +{-- /snippet fill --} +fill = undefined }