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.
The
lengthfunction fromUniversum.Container.Classmodule returnsInt, and we can returnNaturalthere and make it type-safe because it is obvious that the size of the container is always non-negative. It will avoid unnecessaryfromIntegral @Int @Naturalconversions that seem unsafe at first glance.If there are functions with a similar invariant that also return
Int, they should also be changed.