pretty icon indicating copy to clipboard operation
pretty copied to clipboard

`fsep` and `fcat` are confusing as well. Does anyone know what "Paragraph fill" mean in this context?

Open jwaldmann opened this issue 3 years ago • 1 comments

fsep and fcat are confusing as well. Does anyone know what "Paragraph fill" mean in this context?

"Paragraph fill" version of sep.
"Paragraph fill" version of cat.

Originally posted by @banacorn in https://github.com/haskell/pretty/issues/48#issuecomment-793432598

jwaldmann avatar Feb 16 '22 17:02 jwaldmann

I agree this is under-documented. There is no mention of "paragraph fill" in the original paper? http://belle.sourceforge.net/doc/hughes95design.pdf

From experimentation, the semantics of fcat/fsep seems to be

  • if each element is one-line: fill up current line (with hcat or hsep) until ribbon width, then insert line break and repeat
  • else, vcat

There's a specification in the code https://hackage.haskell.org/package/pretty-1.1.3.6/docs/src/Text.PrettyPrint.Annotated.HughesPJ.html#fsep

Perhaps something (from that spec, or from my comment here) could be lifted to API doc.

jwaldmann avatar Feb 16 '22 17:02 jwaldmann