Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use prettyprinter instead of ansi-wl-pprint #77

Closed
wants to merge 1 commit into from

Conversation

jasagredo
Copy link

I didn't do anything fancy, just "inlining" what I found in prettyprinter-compat-ansi-wl-pprint.

@@ -109,7 +109,7 @@ import Data.These (These (..))
-- primitive
import qualified Data.Primitive as Prim

#if MIN_VERSION_base(4,9,0)
#if MIN_VERSION_base(4,17,0)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if I was doing something weird, but this module seems to only exist in base >=4.17, that's why I updated this cpp

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@phadej phadej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't accept this change as such. It's a breaking change.

I have thought about how to do this and the streps are:

  • add prettyprinter dependency (behind a manual flag) and functionality similarly how there are printers using pretty and ansi-wl-pprint.
  • make ansi-wl-pprint dependency behind a flag too (enabled)
  • make ansi-wl-pprint flag disabled by default. Later, as that will be a breaking change.

But I'm unsure about this. Maybe I won't do flags, but rather a companion packages.

@@ -109,7 +109,7 @@ import Data.These (These (..))
-- primitive
import qualified Data.Primitive as Prim

#if MIN_VERSION_base(4,9,0)
#if MIN_VERSION_base(4,17,0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@9999years
Copy link

Any way to move forward on this? The rest of the ecosystem has moved on but tree-diff has been broken for a year+

@phadej
Copy link
Collaborator

phadej commented Nov 9, 2024

has been broken for a year+

What you mean by that? tree-diff uses prettyprint via shim.

@9999years
Copy link

@phadej See #91, an upstream change in ansi-wl-pprint means that show no longer renders colored output correctly:

The ansi-wl-pprint changelog for 1.0.2 says that "Using show won't preserve formatting anymore, as prettyprinters Show Doc instance is annotation invariant."

The only way to fix this is by using Prettyprinter.Render.Terminal.renderStrict to render output, which is not exposed from ansi-wl-pprint. I can't see a way around adding an prettyprinter-ansi-terminal dependency.

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.

3 participants