Skip to content

Remove the dependency on legacy ansi-wl-pprint - #2363

Open
felixonmars wants to merge 1 commit into
elm:mainfrom
felixonmars:prettyprinter-compat
Open

Remove the dependency on legacy ansi-wl-pprint#2363
felixonmars wants to merge 1 commit into
elm:mainfrom
felixonmars:prettyprinter-compat

Conversation

@felixonmars

Copy link
Copy Markdown

Quick Summary:

The ansi-wl-pprint < 1 constraint keeps Elm tied to the old 0.6 implementation and blocks dependency upgrades. Move to prettyprinter, using its compatibility package to retain the existing document API and rendering calls. Require compatibility version 1.1 for its fix to renderPretty's ribbon fraction handling.

The JSON renderer inspects the old SGR-based SimpleDoc representation, so adapt it to prettyprinter's annotation stream while retaining the JSON schema and color names. Reuse AnsiStyle composition to track nested styles and allow the compatibility module's deprecation warnings under -Werror.

Tested the equivalent 0.19.1 patch against the original renderer and ansi-wl-pprint 0.6.9 using 5,580 AI-generated test cases, including 25 parser diagnostics. 5,506 JSON outputs match exactly; differences are trailing whitespace and four legacy style cases unused by Elm. All JSON outputs agree with native ANSI rendering, and eight terminal cases have identical output and exit status.

A full build succeeded on Arch Linux with GHC 9.6.6.

  • Elm: 0.19.1
  • Browser: n/a
  • Operating System: Arch Linux

Additional Details

n/a

The ansi-wl-pprint < 1 constraint keeps Elm tied to the old 0.6
implementation and blocks dependency upgrades. Move to prettyprinter,
using its compatibility package to retain the existing document API and
rendering calls. Require compatibility version 1.1 for its fix to
renderPretty's ribbon fraction handling.

The JSON renderer inspects the old SGR-based SimpleDoc representation, so
adapt it to prettyprinter's annotation stream while retaining the JSON
schema and color names. Reuse AnsiStyle composition to track nested styles
and allow the compatibility module's deprecation warnings under -Werror.

Tested the equivalent 0.19.1 patch against the original renderer and
ansi-wl-pprint 0.6.9 using 5,580 AI-generated test cases, including 25
parser diagnostics. 5,506 JSON outputs match exactly; differences are
trailing whitespace and four legacy style cases unused by Elm. All JSON
outputs agree with native ANSI rendering, and eight terminal cases have
identical output and exit status.

A full build succeeded on Arch Linux with GHC 9.6.6.
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for suggesting these code changes. To set expectations:

  • Pull requests are reviewed in batches, so it can take some time to get a response.
  • Smaller pull requests are easier to review. To fix nine typos, nine specific issues will always go faster than one big one. Learn why here.
  • Reviewers may not know as much as you about certain situations, so add links to supporting evidence for important claims, especially regarding standards for CSS, HTTP, URI, etc.

Finally, please be patient with the core team. They are trying their best with limited resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant