[Haskell-cafe] Combining wl-pprint and ByteString?

Mark Spezzano mark.spezzano at chariot.net.au
Tue Nov 9 01:53:11 EST 2010

Hi all,

I want to do the following tasks in this order:

1. Read text from standard input (should this be stored internally in my program as a ByteString or as a String?)

2. Process the text via left justifying it and making it word-wrap (again, internally, should I store this as a ByteString or String?)

3. Format the text using the Wadler-Leijen Pretty Printer (to the best of my knowledge this  only processes Strings, but not ByteStrings)

4. Print to Standard output the formatted (i.e. colourised, and justified) text (again, should this be as a ByteString or as a String?)

I thought that the reason that most people use ByteString was for _performance_, but wl-pprint can only process Strings to the best of my knowledge.

I would, ideally, like to use ByteStrings everywhere...all throughout my code. Is this possible with coloured text?

I want to boost up the performance of my application dramatically, so in theory I could process everything as a String, then as the last second pack everything processed into a ByteString and print it out...I think that this might work. Then again it might not because of the types expected. Any help with this would be appreciated.


Mark Spezzano


More information about the Haskell-Cafe mailing list