On 27 October 2010 20:13, Stephen Tetley <stephen.tet...@gmail.com> wrote: > On 27 October 2010 09:32, Ivan Lazar Miljenovic > <ivan.miljeno...@gmail.com> wrote: > >> I had to write my own [1] for two reasons: 1) I needed to be able to >> differentiate between quoted and un-quoted values, and 2) some of the >> ways values get pretty-printed are different than just "text . show", >> which is what all the default instances of the Pretty classes are >> (with the exception of String). It's this second point that I would >> wonder how many people would use a default Pretty class: just because >> I want to print String values one way, does that you mean you should >> print them that way as well? > > If you were specifically working around issues of quoting, maybe there > would have been room for an alternative design where an Identifier > datatype had two constructors one for simple strings and one for > quoted ones.
Well, in my case it's because Dot attributes need to have their values in quotes when they contain spaces, etc. As such, you have these situations: * ` DotNode 1 [Label $ StrLabel "foo"] ' is printed as ` 1 [label=foo] ' * ` DotNode 2 [Label $ StrLabel "bar baz"] ' is printed as ` 2 [label="bar baz"] ' Now, I _could_ have just quoted everything, but I tried to make the generated Dot code as "correct" as possible. > In a nutshell, wl-pprint seems to have got the interface 'right' for > my tastes. I like having both named primitive printers and a Pretty > class. If I want printers for ShowS types or for Docs that don't need > page formatting I always copy Wl-pprint's interface. OK, I'll keep the class in as well. What about my other queries (e.g. to keep SimpleDoc or not)? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe