Text.PrettyPrint.HughesPJ -- has a ByteString version ever been considered?

Hello libraries [= maintainer of 'pretty' package], I'm a happy user of the pretty printing library, with which I emit large quantities of nicely indented C++ code. Sometimes I append large strings with "text x <>". In this case performance improvements would not go unappreciated. Has there been any thought of a ByteString version? I notice that the source is only 1K lines. While I imagine that you wouldn't want to break the interface in a backwards compatible way, would it be possible to simple give the "TextDetails" type a parameter and then use a StringLike class (with length, append, what else?). Text.PrettyPrint.HughesPJ could keep the same interface, and the generic version could go in Text.PrettyPrint.HughesPJGeneric or Text.PrettyPrint.HughesPJ.Generic or whatever. Cheers, -Ryan P.S. I notice that other packages like mainland-pretty and ansi-wl-pprint are similarly committed to "String".

On 24 January 2011 12:01, Ryan Newton
Hello libraries [= maintainer of 'pretty' package],
I'm a happy user of the pretty printing library, with which I emit large quantities of nicely indented C++ code. Sometimes I append large strings with "text x <>".
In this case performance improvements would not go unappreciated. Has there been any thought of a ByteString version?
Not quite what you're asking, but I'm almost ready to release a text [1] version of wl-pprint [2]. The darcs repo can be found at http://code.haskell.org/~ivanm/wl-pprint-text/ [1]: http://hackage.haskell.org/package/text [2]: http://hackage.haskell.org/package/wl-pprint
I notice that the source is only 1K lines. While I imagine that you wouldn't want to break the interface in a backwards compatible way, would it be possible to simple give the "TextDetails" type a parameter and then use a StringLike class (with length, append, what else?). Text.PrettyPrint.HughesPJ could keep the same interface, and the generic version could go in Text.PrettyPrint.HughesPJGeneric or Text.PrettyPrint.HughesPJ.Generic or whatever.
I'm not sure how well that would work, especially because you'd typically want to use a Builder for the internals (maybe a DList for String?) rather than the type itself. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

Thanks! That sounds perfect. To be honest, I presently have no good reason for using one pretty printing package instead of another. I will look forward to a future Hackage having reviews, ratings, voted best-of-breed packages, or whatnot to make a little more sense of competing packages. -Ryan On Sun, Jan 23, 2011 at 9:09 PM, Ivan Lazar Miljenovic < ivan.miljenovic@gmail.com> wrote:
Hello libraries [= maintainer of 'pretty' package],
I'm a happy user of the pretty printing library, with which I emit large quantities of nicely indented C++ code. Sometimes I append large strings with "text x <>".
In this case performance improvements would not go unappreciated. Has
On 24 January 2011 12:01, Ryan Newton
wrote: there been any thought of a ByteString version?
Not quite what you're asking, but I'm almost ready to release a text [1] version of wl-pprint [2]. The darcs repo can be found at http://code.haskell.org/~ivanm/wl-pprint-text/http://code.haskell.org/%7Eivanm/wl-pprint-text/
[1]: http://hackage.haskell.org/package/text [2]: http://hackage.haskell.org/package/wl-pprint
I notice that the source is only 1K lines. While I imagine that you wouldn't want to break the interface in a backwards compatible way, would it be possible to simple give the "TextDetails" type a parameter and then use a StringLike class (with length, append, what else?). Text.PrettyPrint.HughesPJ could keep the same interface, and the generic version could go in Text.PrettyPrint.HughesPJGeneric or Text.PrettyPrint.HughesPJ.Generic or whatever.
I'm not sure how well that would work, especially because you'd typically want to use a Builder for the internals (maybe a DList for String?) rather than the type itself.
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

The loss of unicode and other text-centric features make this proposal
rather uncomfortable. Not that I use it, but perhaps it would be
better to make a pretty package targeting 'text'?
Cheers,
Thomas
On Sun, Jan 23, 2011 at 6:01 PM, Ryan Newton
Hello libraries [= maintainer of 'pretty' package],
I'm a happy user of the pretty printing library, with which I emit large quantities of nicely indented C++ code. Sometimes I append large strings with "text x <>".
In this case performance improvements would not go unappreciated. Has there been any thought of a ByteString version?
I notice that the source is only 1K lines. While I imagine that you wouldn't want to break the interface in a backwards compatible way, would it be possible to simple give the "TextDetails" type a parameter and then use a StringLike class (with length, append, what else?). Text.PrettyPrint.HughesPJ could keep the same interface, and the generic version could go in Text.PrettyPrint.HughesPJGeneric or Text.PrettyPrint.HughesPJ.Generic or whatever.
Cheers, -Ryan
P.S. I notice that other packages like mainland-pretty and ansi-wl-pprint are similarly committed to "String".
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On 24.01.11 03:01, Ryan Newton wrote:
Hello libraries [= maintainer of 'pretty' package],
I'm a happy user of the pretty printing library, with which I emit large quantities of nicely indented C++ code. Sometimes I append large strings with "text x<>".
In this case performance improvements would not go unappreciated. Has there been any thought of a ByteString version? Hi Ryan, it would be really interesting to know whether a 'naive', backwards-compatible variant using Data.Text for the 'TextDetail' datatype already provides useful performance improvements. I've put a small patch online
which does this, and provides additional functionality via
ptext :: T.Text -> Doc renderText :: Doc -> T.Text
I'm curious whether this helps. cheers, Benedikt
I notice that the source is only 1K lines. While I imagine that you wouldn't want to break the interface in a backwards compatible way, would it be possible to simple give the "TextDetails" type a parameter and then use a StringLike class (with length, append, what else?). Text.PrettyPrint.HughesPJ could keep the same interface, and the generic version could go in Text.PrettyPrint.HughesPJGeneric or Text.PrettyPrint.HughesPJ.Generic or whatever.
Cheers, -Ryan
P.S. I notice that other packages like mainland-pretty and ansi-wl-pprint are similarly committed to "String".
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
participants (5)
-
Benedikt Huber
-
Ivan Lazar Miljenovic
-
Ryan Newton
-
Ryan Newton
-
Thomas DuBuisson