Skip to content

Add instance ann ~ Void => Pretty (Doc ann) - #234

Merged
quchen merged 1 commit into
haskell-prettyprinter:masterfrom
phadej:instance-pretty-doc
Apr 26, 2024
Merged

quchen merged 1 commit into
haskell-prettyprinter:masterfrom
phadej:instance-pretty-doc

Conversation

@phadej

@phadej phadej commented Jan 10, 2023

Copy link
Copy Markdown
Contributor

When there are no annotations, Doc is Pretty.

When there are no annotations, Doc is Pretty.

@sjakobi sjakobi left a comment

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.

Thanks! This instance had previously come up in #227.

The CI failure seems unrelated. I'll try to take care of it soon.

-- , (1, [2, 2, 2, 2, 2, 2, 2, 2]) ] ]

instance ann ~ Void => Pretty (Doc ann) where
pretty = vacuous

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.

Doesn't vacuous perform useless work traversing the Doc?! It's implemented as fmap absurd.

How about this instead?!

Suggested change
pretty = vacuous
pretty = unsafeCoerce

@phadej phadej Jan 16, 2023 •

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.

pretty = unsafeCoerce

You forgot a two hundred word essay justifying it.

E.g. I'm not sure what happens when there are bottoms, annotate (error "surprise") doc :: Doc Void.

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.

To be clear: I won't author a commit with unsafeCoerce even fmap absurd is almost always can be replaced by it.

@phadej

phadej commented Mar 16, 2023

Copy link
Copy Markdown
Contributor Author

ping

1 similar comment
@phadej

phadej commented May 29, 2023

Copy link
Copy Markdown
Contributor Author

ping

@quchen
quchen merged commit eccc839 into haskell-prettyprinter:master Apr 26, 2024
@phadej
phadej deleted the instance-pretty-doc branch April 27, 2024 11:08
@phadej

phadej commented Jul 12, 2024

Copy link
Copy Markdown
Contributor Author

I see this is merged, but it's not yet release. Any ETA for the release, @sjakobi @quchen ?

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