这是indexloc提供的服务,不要输入任何密码
Skip to content

[Docs] Add section on custom propositions #1345

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

Merged
merged 4 commits into from
Nov 10, 2023

Conversation

micahcantor
Copy link
Contributor

@micahcantor micahcantor commented Nov 5, 2023

Section 5.2 of the guide describes how Typed Racket narrows types with propositions. However, I don't think this section makes it clear if and how users can define their own propositions from predicates. In 5.2, the proposition for the built-in type predicate string? is discussed. Then, in 5.2.1, it jumps to defining custom one-sided propositions, a slightly more advanced concept. I think it could use a section in between that makes it explicit how to create a proposition from a predicate.

Personally, I ran into this issue when I was learning Typed Racket: at the time I didn't understand from the guide how to define my own proposition. I asked a question on StackOverflow and got an answer, but I think this would be more clear with an example in the guide.

This PR adds such an example. I was a bit confused on whether to use @examples or @racketblock so I chose the latter which seemed simpler, but feel free to recommend changes to that, to the writing, or more generally to the structure/position of this section.

@micahcantor micahcantor changed the title Add section on custom propositions [Docs] Add section on custom propositions Nov 5, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Resyntax analyzed 0 files in this pull request and found no issues.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Resyntax analyzed 0 files in this pull request and found no issues.

@sorawee
Copy link
Contributor

sorawee commented Nov 6, 2023

I proposed a suggestion at micahcantor#1.

@micahcantor
Copy link
Contributor Author

Looks good, I think adding that example makes it more clear why we would need to add the proposition

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Resyntax analyzed 0 files in this pull request and found no issues.

@sorawee sorawee added this to the 8.12 milestone Nov 9, 2023
@sorawee sorawee merged commit d1ba049 into racket:master Nov 10, 2023
sorawee added a commit that referenced this pull request Nov 10, 2023
This is a follow up of #1345.

Thanks to @capfredf for the improvement suggestion.
@samth
Copy link
Member

samth commented Nov 10, 2023

Thanks!

@micahcantor micahcantor deleted the proposition-docs branch November 10, 2023 22:32
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.

4 participants