darcs

Issue 2728 replace our home-grown pretty printer with a library from hackage

Title replace our home-grown pretty printer with a library from hackage
Priority Status unknown
Milestone Resolved in
Superseder Nosy List bfrk
Assigned To
Topics

Created on 2024-06-29.13:12:21 by bfrk, last changed 2024-07-25.09:04:53 by bfrk.

Messages
msg24059 (view) Author: bfrk Date: 2024-06-29.13:12:21
Initially I thought that the 'prettyprinter' package could serve that 
purpose. But their 'emptyDoc' is not a unit for vertical composition, which 
is something we pretty much rely on (IIRC). We also do not need rendering 
based on document width etc. However, I do like their SimpleDocStream type, 
not least because the 'terminal' package provides a backend to render it to 
a terminal with colors etc. So perhaps we could re-write our 
Darcs.Util.Printer to create a SimpleDocStream.
msg24069 (view) Author: bfrk Date: 2024-07-25.09:04:51
Instead of refactoring Darcs.Util.Printer, I have been working on a clean 
separation of formatting for storage vs. for display. The idea is to add a 
new class FormatPatch that does not use Darcs.Util.Printer, just a small 
wrapper for Data.Bytestring.Builder (residing in Darcs.Util.Format) that 
implements the (few) functions and operators we need for storage 
formatting.

To do this, I had to remove the "show with context lines" feature from 
patch bundles. (They were never meant for display to humans; what /is/ 
meant for human consumption is the patch-preview.txt file which we attach 
to patch bundles when creating emails to send; we can always create a 
separate routine to create this preview file in a way that doesn't 
interfere with the bundle itself; we could even create a html version with 
coloring and everything.)

This move gets us rid of the whole ugly array of types and classes in 
Darcs.Patch.Format (FileNameFormat, PatchListFormat, etc) and puts 
formatting patches (and, BTW, also inventories) for storage and data 
transfer on a robust foundation. I have made these changes on my 
experimental branch, so it depends on lots of other unpublished changes. 
It would be nice if I could get most of that into screened at some 
point...
History
Date User Action Args
2024-06-29 13:12:21bfrkcreate
2024-07-25 09:04:53bfrksetmessages: + msg24069