Skip to content

Commit 0dbe08f

Browse files
Reword misleading documentation for layoutPretty (#229)
The docs implied that `layoutPretty` looks ahead by a single text element, which is not accurate - it looks ahead to the end of the line. I also reworded the `layoutSmart` docs, which implied that it tries to fit the whole document into one line.
1 parent 898248f commit 0dbe08f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

prettyprinter/src/Prettyprinter/Internal.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,9 +1806,9 @@ defaultLayoutOptions = LayoutOptions { layoutPageWidth = defaultPageWidth }
18061806
-- | This is the default layout algorithm, and it is used by 'show', 'putDoc'
18071807
-- and 'hPutDoc'.
18081808
--
1809-
-- @'layoutPretty'@ commits to rendering something in a certain way if the next
1810-
-- element fits the layout constraints; in other words, it has one
1811-
-- 'SimpleDocStream' element lookahead when rendering. Consider using the
1809+
-- @'layoutPretty'@ commits to rendering something in a certain way if the
1810+
-- remainder of the current line fits the layout constraints; in other words,
1811+
-- it has up to one line of lookahead when rendering. Consider using the
18121812
-- smarter, but a bit less performant, @'layoutSmart'@ algorithm if the results
18131813
-- seem to run off to the right before having lots of line breaks.
18141814
layoutPretty
@@ -1839,8 +1839,8 @@ layoutPretty (LayoutOptions pageWidth_@(AvailablePerLine lineLength ribbonFracti
18391839
layoutPretty (LayoutOptions Unbounded) = layoutUnbounded
18401840

18411841
-- | A layout algorithm with more lookahead than 'layoutPretty', that introduces
1842-
-- line breaks earlier if the content does not (or will not, rather) fit into
1843-
-- one line.
1842+
-- line breaks earlier if the content does not (or will not, rather) fit within
1843+
-- the page width.
18441844
--
18451845
-- Consider the following python-ish document,
18461846
--

0 commit comments

Comments
 (0)