Side-by-side pretty printing

Hi all, When looking into Text.PrettyPrint, I stumbled upon <> (beside) combinator. Is it true that multi-line documents can't be printed one beside other? E.g. this let doc1 = vcat $ map text ["This", "is", "a", "document"] in doc1 <> doc1 prints this: This is a documentThis is a document As well as if I would write `doc1 <> nest 50 doc1`. What I was expecting, was This This is is a a documentdocument Do I get it right that Text.PrettyPrint was not intended for such things?

Hi Michael
On 5 August 2014 20:49, Michael Lazarev
Do I get it right that Text.PrettyPrint was not intended for such things?
Yes - the common pretty printers do not handle column printing, generally they are for laying out text with nesting - typically program code. Maybe someone has written a column-oriented pretty printer, it is not so hard - I've written "internal" ones a few times, but never polished one up enough to publish.

2014-08-06 0:27 GMT+04:00 Stephen Tetley
Yes - the common pretty printers do not handle column printing, generally they are for laying out text with nesting - typically program code.
Maybe someone has written a column-oriented pretty printer, it is not so hard - I've written "internal" ones a few times, but never polished one up enough to publish.
I sketched one on a blackboard today, during a workshop. It turned out to be pretty easy in Haskell. Just wanted to double-check that I understand capabilities of Text.PrettyPrint correctly, as it's hard for me to understand the code closer to the end of this module. Thank you very much for your help!

This is what I use http://autolat.imn.htwk-leipzig.de/gitweb/?p=autolib;a=blob;f=todoc/Autolib/... it's of the works-but-looks-ugly-and-is-terribly-inefficient variety but since it's applied to small Docs only (like, columns of matrices), I don't really care. - J.W.
participants (3)
-
J. Waldmann
-
Michael Lazarev
-
Stephen Tetley