Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ anymore.

Text is not all letters and newlines. Often, we want to add more information,
the simplest kind being some form of styling. An ANSI terminal supports
coloring, a web browser a plethora of different formattings.
coloring, a web browser a plethora of different formatting.

More complex uses of annotations include e.g. adding type annotations for
mouse-over hovers when printing a syntax tree, adding URLs to documentation, or
Expand Down
2 changes: 1 addition & 1 deletion prettyprinter-convert-ansi-wl-pprint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ the new `prettyprinter` one. Its purpose is making packages that only generate
`ansi-wl-pprint` data available to the `prettyprinter` ecosystem.

Note the difference to the `prettyprinter-compat-ansi-wl-pprint` module, which
does *not* convert any data, and instead provides an API that mimicks
does *not* convert any data, and instead provides an API that mimics
`ansi-wl-pprint`, while secretly being `prettyprinter`-based behind the
curtains. This package on the other hand does a proper conversion.

Expand Down
2 changes: 1 addition & 1 deletion prettyprinter/app/GenerateReadme.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ readmeContents = (mconcat . L.intersperse vspace)
, paragraph [multiline| Text is not all letters and newlines. Often, we
want to add more information, the simplest kind being some form of
styling. An ANSI terminal supports coloring, a web browser a plethora of
different formattings. |]
different formatting. |]

, paragraph [multiline| More complex uses of annotations include e.g.
adding type annotations for mouse-over hovers when printing a syntax
Expand Down
4 changes: 2 additions & 2 deletions prettyprinter/src/Prettyprinter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
--
-- /Modularity:/ To change the color of keywords later, you have to touch one
-- point, namely the mapping in @'reAnnotateS'@, where @'Keyword'@ is mapped to
-- 'Red'. If you have @'annotate Red …'@ everywher, you’ll have to do a full
-- 'Red'. If you have @'annotate Red …'@ everywhere, you’ll have to do a full
-- text replacement, producing a large diff and touching lots of places for a
-- very small change.
--
Expand Down Expand Up @@ -224,7 +224,7 @@ module Prettyprinter (
-- * List functions

-- | The 'sep' and 'cat' functions differ in one detail: when 'group'ed, the
-- 'sep's replace newlines wich 'space's, while the 'cat's simply remove
-- 'sep's replace newlines which 'space's, while the 'cat's simply remove
-- them. If you're not sure what you want, start with the 'sep's.

concatWith,
Expand Down
12 changes: 6 additions & 6 deletions prettyprinter/src/Prettyprinter/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ indent i d = hang i (spaces i <> d)
-- list [1,20,300,4000]
--
-- If there is not enough space, then the input is split into lines entry-wise
-- therwise they are laid out vertically, with separators put in the front:
-- otherwise they are laid out vertically, with separators put in the front:
--
-- >>> putDocW 10 doc
-- list [1
Expand Down Expand Up @@ -1364,7 +1364,7 @@ annotate = Annotated
-- @
--
-- it should not be used without caution, for each invocation traverses the
-- entire contained document. If possible, it is preferrable to unannotate after
-- entire contained document. If possible, it is preferable to unannotate after
-- producing the layout by using 'unAnnotateS'.
unAnnotate :: Doc ann -> Doc xxx
unAnnotate = alterAnnotations (const [])
Expand All @@ -1375,7 +1375,7 @@ unAnnotate = alterAnnotations (const [])
-- generally annotated document.
--
-- Since this traverses the entire @'Doc'@ tree, including parts that are not
-- rendered due to other layouts fitting better, it is preferrable to reannotate
-- rendered due to other layouts fitting better, it is preferable to reannotate
-- after producing the layout by using @'reAnnotateS'@.
--
-- Since @'reAnnotate'@ has the right type and satisfies @'reAnnotate id = id'@,
Expand All @@ -1396,7 +1396,7 @@ reAnnotate re = alterAnnotations (pure . re)
-- not vice-versa.
--
-- Since this traverses the entire @'Doc'@ tree, including parts that are not
-- rendered due to other layouts fitting better, it is preferrable to reannotate
-- rendered due to other layouts fitting better, it is preferable to reannotate
-- after producing the layout by using @'alterAnnotationsS'@.
alterAnnotations :: (ann -> [ann']) -> Doc ann -> Doc ann'
alterAnnotations re = go
Expand Down Expand Up @@ -1871,7 +1871,7 @@ layoutPretty (LayoutOptions Unbounded) = layoutUnbounded
-- |------------------------|
--
-- Note that this exceeds the desired 26 character page width. The same
-- document, rendered with @'layoutSmart'@, fits the layout contstraints:
-- document, rendered with @'layoutSmart'@, fits the layout constraints:
--
-- >>> go layoutSmart doc
-- |------------------------|
Expand Down Expand Up @@ -1986,7 +1986,7 @@ layoutWadlerLeijen
where

-- * current column >= current nesting level
-- * current column - current indentaion = number of chars inserted in line
-- * current column - current indentation = number of chars inserted in line
best
:: Int -- Current nesting level
-> Int -- Current column, i.e. "where the cursor is"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,6 @@ unsafePeekStyle = StackMachine (\styles -> case styles of
writeOutput :: output -> StackMachine output style ()
writeOutput w = StackMachine (\styles -> ((), w, styles))

-- | Run the renderer and retrive the writing end
-- | Run the renderer and retrieve the writing end
execStackMachine :: [styles] -> StackMachine output styles a -> (output, [styles])
execStackMachine styles (StackMachine r) = let (_, w, s) = r styles in (w, s)