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
length
function fromUniversum.Container.Class
module returnsInt
, and we can returnNatural
there and make it type-safe because it is obvious that the size of the container is always non-negative. It will avoid unnecessaryfromIntegral @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.