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

Return Natural in functions that return the size of the container #245

Open
DMozhevitin opened this issue Sep 2, 2021 · 0 comments · May be fixed by #248
Open

Return Natural in functions that return the size of the container #245

DMozhevitin opened this issue Sep 2, 2021 · 0 comments · May be fixed by #248

Comments

@DMozhevitin
Copy link

DMozhevitin commented Sep 2, 2021

The length function from Universum.Container.Class module returns Int, and we can return Natural there and make it type-safe because it is obvious that the size of the container is always non-negative. It will avoid unnecessary fromIntegral @Int @Natural conversions that seem unsafe at first glance.

If there are functions with a similar invariant that also return Int, they should also be changed.

DK318 added a commit to DK318/universum that referenced this issue Nov 3, 2021
@DK318 DK318 linked a pull request Nov 3, 2021 that will close this issue
9 tasks
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 a pull request may close this issue.

1 participant