[darcs-users] Replace src/Printer.lhs with an external library?

Ian Lynagh igloo at earth.li
Thu Mar 26 14:06:58 UTC 2009


On Thu, Mar 26, 2009 at 09:07:57AM +0000, Eric Kow wrote:
> On Thu, Mar 26, 2009 at 10:01:51 +0100, Nicolas Pouillard wrote:
> > I think that one advantage of Darcs' printer was performances, some minor
> > others are colors, escapings, and tunable policies.
> 
> Would it make sense to turn this into a general purpose library of our
> own?  Would anybody else have a use for this?  Ian wrote large chunks of
> this (at least the ColorPrinter module, if I remember), maybe he would
> be inclined to comment,

It's been a long time since I looked at this code, but these are the
differences I can think of between darcs's Printer and Text.PrettyPrint:

* Back then, Text.PrettyPrint didn't have zeroWidthText. Now it does,
  which makes adding colour support more reasonable.

* darcs's Printer is simpler than Text.PrettyPrint, which may or may not
  mean that it is faster; I suspect not, though.

* Text.PrettyPrint doesn't give you a way to print any sort of packed
  string type without unpacking it. This is waiting on there being a
  suitable unicode packed string type for it to use.

So I'd say that switching to Text.PrettyPrint after the third point is
fixed, assuming I'm right about the second, would be the way to go. But
someone should look into whether there are any other problems lurking.

> for example, on the feasibility of a general
> printer library that darcs and camp could share?

camp currently uses Text.PrettyPrint, although it doesn't do much pretty
printing and doesn't do anything clever.


Thanks
Ian



More information about the darcs-users mailing list