Unexpected behaviour in Text.PrettyPrint.HughesPJ

Simon Peyton-Jones simonpj at microsoft.com
Fri Sep 23 05:52:25 EDT 2005


Ah yes -- a better answer than mine.  

Simon

| -----Original Message-----
| From: libraries-bounces at haskell.org
[mailto:libraries-bounces at haskell.org] On Behalf Of Johannes
| Waldmann
| Sent: 23 September 2005 09:55
| To: Simon Peyton-Jones
| Cc: Haskell libraries
| Subject: Re: Unexpected behaviour in Text.PrettyPrint.HughesPJ
| 
| 
| > | test = text "foo" <+> empty <> text "bar"
| > |
| > | Running 'show test' now gives the string "foobar" as a result
(whereas I
| > | expected "foo bar").It seems the empty "eats" the space that I
expect
| > | <+> to give me.
| 
| by definition,  x <+> empty == x.
| 
| what happens here is related to precedences:
| 
| Text.PrettyPrint.HughesPJ> text "foo" <+> empty <> text "bar"
| foobar
| Text.PrettyPrint.HughesPJ> text "foo" <+> ( empty <> text "bar" )
| foo bar
| 
| best regards,
| --
| -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
| ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------
| 
| _______________________________________________
| Libraries mailing list
| Libraries at haskell.org
| http://www.haskell.org/mailman/listinfo/libraries


More information about the Libraries mailing list