[Haskell-cafe] Meaning of "ribbonsPerLine" at Text.PrettyPrint.HughesPJ ?

Alfonso Acosta alfonso.acosta at gmail.com
Wed Jun 18 16:13:13 EDT 2008


Hi,

Can anyone give a good explanation of what ribbonsPerLine means?

Maybe it would be better to simply ask for the meaning of ribbon in
this context. The documentation is totally meaningless to me:
"reibbonsPerLine: Ratio of ribbon length to line length".

I asked at #haskell and frankly, I was surprised by the answer:

fons: can anyone tell me what the heck does ribbonsPerLine mean in
Text.PrettyPrint.HughesPJ?
fons: > renderStyle style{lineLength=10, ribbonsPerLine=1} $ sep [text
"foo" ,text "bar"]
lambdabot:  "foo bar"
fons: > renderStyle style{lineLength=10, ribbonsPerLine=2} $ sep [text
"foo" ,text "bar"]
lambdabot:  "foo\nbar"
fons: ok, somehow it affects the line width ...
byorgey: fons: I can't explain it, all I know is that you must set it
to 1 or else it does bizarre things
fons: hahah, ok
fons: byorgey: that's funny considering its default value is 1.5
byorgey: if you set it to 1 then lineLength means what you think it should
byorgey: fons: EXACTLY

Cheers,

Fons


More information about the Haskell-Cafe mailing list