-
-
Notifications
You must be signed in to change notification settings - Fork 103
[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
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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.
I proposed a suggestion at micahcantor#1. |
doc: refine custom propositions section
Looks good, I think adding that example makes it more clear why we would need to add the proposition |
There was a problem hiding this 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.
Thanks! |
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.