On 23 Apr 2012, at 17:49, Evan Laforge wrote: > I use a custom Pretty class along with HughesPJ, ala ghc's Outputable. > It means I can omit data or print it out in a more readable form > (even just rounding floats to %.03f can help a lot), and also get nice > layout and wrapping.
I think I do something similar, although not hooking it up with a proper pretty printing library (that manages indentation etc), but which just stupid builds strings à la Show. http://hackage.haskell.org/packages/archive/GenI/latest/doc/html/NLP-GenI-Pretty.html I wish I knew about a Commonly Agreed Idiom (or library) for just recursively creating human-friendly text, but I suspect I only say this because I don't have a clear picture what I'm really wishing for. Does everybody just use HughesPJ? I'll also mention that it took me a while to untangle all the various notions of showing things in my code. Now it's * Show: Haskell * GraphvizShow: dot * GeniShow: outputting structures in my custom text format * Pretty: for talking to humans Embarrassing to say that until recently my code was a random mismash of uses and unclear thinking. For example, it hadn't occurred to me that I shouldn't define GeniShow in terms of other things (but vice versa) because I don't want to accidentally change my file format just because I was trying to make something prettier. Oops. -- Eric Kow <http://erickow.com>
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe