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

Extraction.Krml: pretty printing #3470

Merged
merged 3 commits into from
Sep 12, 2024
Merged

Conversation

mtzguido
Copy link
Member

No description provided.

@mtzguido mtzguido enabled auto-merge September 12, 2024 16:43
@mtzguido mtzguido merged commit d9c3ebf into FStarLang:master Sep 12, 2024
2 checks passed
@mtzguido mtzguido deleted the krml_pp branch September 12, 2024 16:46

let showable_from_pretty (#a:Type) {| _ : pretty a |} : Tot (Class.Show.showable a) = {
show = (fun x -> render (pp x));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it an issue that there is a cycle in the type class instances now? Can this cause resolution to loop?

The pretty_from_showable instance also feels a bit dangerous, it makes it easy to accidentally get a nonpretty string even if you call pp.

Copy link
Member Author

Choose a reason for hiding this comment

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

They are not instances, so they don't participate in typeclass resolution. They are just normal vals that you can call manually to turn a pretty instance into showable, and viceversa.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, you're right! I totally missed that.

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.

2 participants