[Haskell-cafe] Pretty-printer for Text

Antoine Latter aslatter at gmail.com
Wed Oct 27 10:13:56 EDT 2010

On Tue, Oct 26, 2010 at 9:50 PM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> I'm currently working on a pretty-printer for lazy text [1] values,
> basing the API on the wl-pprint [2] package.
> [1]: http://hackage.haskell.org/package/text
> [2]: http://hackage.haskell.org/package/wl-pprint
> In terms of API decisions, there are a few things I'm not sure of and
> am wondering what other people would prefer:
> * Should the SimpleDoc type still be exported?  Or should the
> rendering functions just return a Builder or lazy Text value?

I'm not really sure what you're asking here, but I find BS Builders
pretty convenient to work with. A recent release of 'text' includes a
Builder type.

> * Is the Pretty class wanted/needed?  If so, should the individual
> combinators (int, bool, etc.) be kept or just use "pretty" for
> everything?

I frequently write a 'Pretty' class when writing complex ASTs, but I
have never found it to be a hardship. I prefer using well-named
combinators for primitive types.

> * Should String values be catered for or just have everything be Text-based?

The OverloadedStrings language extension solves the most common case
for wanting to have string-based pretty-printer functions.


More information about the Haskell-Cafe mailing list