-
-
Notifications
You must be signed in to change notification settings - Fork 103
[Docs] Rename Opt to Maybe in guide #1340
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.
I think the current name is also a common one (e.g. Disambiguating |
I agree, it's less that I think the guide needs to adopt Haskell's terminology, and more that as a newcomer to Typed Racket (but having experience with Haskell/OCaml) the guide was confusing since I didn't know if I should use |
I think we all agree that So let's use the name |
Oops, it's been a little while since I used Haskell instead of OCaml, I did mean that! |
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! |
When I was learning Typed Racket, I was confused by this section of the guide, which gives an example of defining a polymorphic data type. The example used is an optional type called
Opt
, defined analogously toMaybe
in Haskell. Personally, this example was confusing to me since I then thought the the Option type provided by the standard library was defined in the same way. However, that(Option t)
type is actually defined as eithert
or#f
, which aligns better with Racket conventions.To avoid this confusion, and since
Maybe
from Haskell is already mentioned here, I recommend changing the name ofOpt
toMaybe
in this example. I also changed type parameter names to be upper case in this example, for consistency with the rest of the language.It also may be helpful to add a note afterward explaining that in a "real" program, for consistency the user should probably use
Option
rather than their ownMaybe
type, but maybe that's unnecessary, so I left it out here.