[Haskell-cafe] Pretty-printing peg solitaire boards
Stefan O'Rear
stefanor at cox.net
Sun Nov 25 00:43:53 EST 2007
On Sun, Nov 25, 2007 at 03:40:26AM -0200, Maurício wrote:
> Hi,
>
> I'm trying to pretty-print (with Text
> . PrettyPrint . HughesPJ) a set of peg solitaire
> boards. No matter what I try, I always get this:
>
> 00#
> 00#
> 0000#00
> 0000000
> 0000000
> 000
> 000 : 00#
> 00#
> 0000000
> 0000000
> 0000000
> 000
> 000
>
> but what I really want is this:
>
> 00# 00#
> 00# 00#
> 0000#00 0000000
> 0000000 : 0000000
> 0000000 000
> 000 000
> 000 000
>
> What I'm I doing wrong? When I have two boards
> a,b::Doc, I'm composing them with
>
> a <+> colon <+> b
>
> and rendering them with just 'render'. Should I
> try something else?
Right; Text.PrettyPrint is designed for rendering code, where there is a
natural 1D structure. For instance, stmt <> semi does the right thing
for code - sticking the semicolon at the very end. For text graphics
you want to do something else...
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071124/9fc95f83/attachment.bin
More information about the Haskell-Cafe
mailing list