quchen / prettyprinter

A modern, extensible and well-documented prettyprinter.
BSD 2-Clause "Simplified" License
293 stars 34 forks source link

How to wrap on any space? #241

Closed newhoggy closed 1 year ago

newhoggy commented 1 year ago

I have the following code:

putDoc $ fillSep $ replicate 10 "the quick brown fox jumped over the lazy dog."

And it produces output like this:

the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.
the quick brown fox jumped over the lazy dog.

Is there a way to make it do this instead?

the quick brown fox jumped over the lazy dog. the quick brown fox jumped over
the lazy dog. the quick brown fox jumped over the lazy dog. the quick brown fox
jumped over the lazy dog. the quick brown fox jumped over the lazy dog. the
quick brown fox jumped over the lazy dog. the quick brown fox jumped over the
lazy dog. the quick brown fox jumped over the lazy dog. the quick brown fox
jumped over the lazy dog. the quick brown fox jumped over the lazy dog.

ie allow any space to break a newline?

newhoggy commented 1 year ago

Ah, reflow!