Unexpected behaviour in Text.PrettyPrint.HughesPJ

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Fri Sep 23 04:55:24 EDT 2005


> | 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/ -------



More information about the Libraries mailing list