Skip to content

Generalise stack machine helper function#164

Closed
georgefst wants to merge 1 commit intohaskell-prettyprinter:masterfrom
georgefst:master
Closed

Generalise stack machine helper function#164
georgefst wants to merge 1 commit intohaskell-prettyprinter:masterfrom
georgefst:master

Conversation

@georgefst
Copy link
Copy Markdown
Contributor

As suggested in #163.

Pass annotation stack to text rendering argument.
Copy link
Copy Markdown
Collaborator

@sjakobi sjakobi left a comment

Choose a reason for hiding this comment

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

This makes sense to me in light of your comment #163 (comment).

@quchen Could you review too?

renderSimplyDecorated
:: Monoid out
=> (Text -> out) -- ^ Render plain 'Text'
=> ([ann] -> Text -> out) -- ^ Render plain 'Text'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The haddocks should say what the [ann] argument is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point. Will add that if this gets merged.

@sjakobi sjakobi linked an issue Jun 12, 2020 that may be closed by this pull request
@sjakobi sjakobi added the PVP: major Requires a major version bump label Jun 12, 2020
@quchen
Copy link
Copy Markdown
Collaborator

quchen commented Jun 17, 2020

Not sure this warrants a breaking change. The whole point of the simple renderers is to provide a fire-and-forget API. For special use cases with options and what not, a custom-built renderer seems to be the way to go.

What use case that’s good for the broader audience does passing the annotation stack have?

@georgefst
Copy link
Copy Markdown
Contributor Author

Not sure this warrants a breaking change

Fair enough.

On reflection, this is probably more niche than I originally thought. Even in my case, there's a better solution that would involve improving the graphviz API.

@georgefst georgefst closed this Jun 17, 2020
@sjakobi
Copy link
Copy Markdown
Collaborator

sjakobi commented Jun 17, 2020

Hm, admittedly that's not the resolution that I had expected. It doesn't seem implausible to me that other users of renderSimplyDecorated might want to have access to the annotation stack too. As breaking changes go, I think this one would also have been on the harmless side.

@georgefst
Copy link
Copy Markdown
Contributor Author

Hm, admittedly that's not the resolution that I had expected.

Yeah, my sudden change of heart mostly comes from the realisation that I probably wouldn't use it anyway in the long run.

As breaking changes go, I think this one would also have been on the harmless side.

Probably true, but it's still a change people would have to adapt to, for no gain in most cases. And prettyprinter has a lot of reverse dependencies, even if the majority of those are probably not using this module since they're not adding backends.

Anyway, this could be reopened, perhaps with the generalised form made in to a separate function, so that it's not a breaking change. And generalised further by e.g. passing the stack to the push and pop functions as well.

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

Labels

PVP: major Requires a major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stack machine is unnecessarily opaque

3 participants