-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
lib/types.nix: add intBetween #27239
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
@Profpatsch, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @nbp and @ericsagnes to be potential reviewers. |
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.
Port ranges have a smaller domain than the integers.
@volth Yeah, there is a whole range of such functions that would be of interest. E.g. postiveInteger (if Nix supports bignums). |
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.
OK by me
An int type that checks the value range.
Before: <x> is not a integer between 0 and 100 (inclusively). (notice that “a” is wrong, it should be “an”) Now: <x> is not of type `integer between 0 and 100 (inclusively)'. This sounds a bit more formal, but circumvents the grammatical problems. Multi-word type descriptions are also easier to see.
Hm, before we merge we should maybe think about that:
If so, a new namespace for these types should probably be created? |
I’m thinking about maybe having
|
I will refactor and open a new PR. |
Add a type for integers between a min and max value; also improve the type error message, see commit message.