
Henning Thielemann wrote:
The Show class converts to String, the Pretty class could convert to a pretty printer data type like Doc. [...]
Ah yes, I use this since a long time class ToDoc a where toDoc :: a -> Doc toDoc = toDocPrec 0 -- useful? toDocPrec :: Int -> a -> Doc http://141.57.11.163/cgi-bin/cvsweb/lib/Autolib/ToDoc/ I generally make even this output re-readable, and I'm reading is via Parsec: class Reader a where readerPrec :: Int -> Parser a http://141.57.11.163/cgi-bin/cvsweb/lib/Autolib/Reader/ and I also have the obvious DrIFT rules that can generate standard instances for most types. http://141.57.11.163/cgi-bin/cvsweb/drift/src/UserRuleToDoc.hs?rev=1.7 http://141.57.11.163/cgi-bin/cvsweb/drift/src/UserRuleReader.hs?rev=1.6 I will happily contribute this code to whatever Pretty class emerges. (Well, it's free, so I'd have no way to not contribute it ...) best regards, Johannes.