[Ticket #2393] Text.PrettyPrint.HughesPJ: Bug fixes, performance improvement

Simon Peyton-Jones simonpj at microsoft.com
Tue Jun 24 08:39:48 EDT 2008

Thank you for doing this Benedict.  I've added your more detailed comments to ticket #2393 so that they are preserved.

Ian: would you like to apply?  I'm not sure how to integrate the QuickCheck tests, but I bet you know.

Benedict: while you are in the area, would you like to take a swing at http://hackage.haskell.org/trac/ghc/ticket/1337, and 1176?


| -----Original Message-----
| From: libraries-bounces at haskell.org [mailto:libraries-bounces at haskell.org] On Behalf Of Benedikt Huber
| Sent: 24 June 2008 13:12
| To: libraries at haskell.org
| Subject: [Ticket #2393] Text.PrettyPrint.HughesPJ: Bug fixes, performance improvement
| Hello,
| I'd like to propose bugfixes, documentation fixes and a performance
| improvement for Text.PrettyPrint.HughesPJ. The changes shouldn't
| effect the expected behaviour of the PP library.
| I've written a QuickCheck test suite for the pretty printer (to test
| the improvement), and found two bugs and some misconceptions/
| ambiguities in the documentation. Additionally, there is a
| microbenchmark for the suggested improvement.
| Both are available at http://code.haskell.org/~bhuber/Text/
| PrettyPrint/. Note that the QuickCheck tests need access to all top-
| level names in HughesPJ (i.e. ignore the export list).
| In summary, I propose to
| * fix a bug in fillNB and one in fillNB/sepNB
| * correct documentation on laws and invariants.
| * add more efficient implementations of vcat,hsep,hcat
| More specifically:
| (1) Bugfix fillNB: Additional case for  fillNB Empty (Empty : ys)
| (2) Bugfix [f](cat|sep): do not allow overlapping ($$) in vertical
| composition
| (3) Lazy implementations of vcat,hcat and hsep
| (4) Law <t2> isn't always true
| (5) Invariant 5 should be made stronger
| (6) Change the comment about negative indentation

More information about the Libraries mailing list