Open thesamet opened 4 years ago
@thesamet Yes, we found that an Inverse
operation that was the inverse of the normal associative operation and "undid" it was more general because you can describe for example subtraction on natural numbers that way whereas you can't do so purely in terms of an inverse value and the normal associative operation because negative numbers aren't in the set of natural numbers. You're right the documentation definitely needs to be updated. Will do that. Thanks for reporting!
Thanks for the quick response, Adam. Since inverse
has a different meaning in algebra, consider renaming the trait to some opposite of combine
, perhaps Subtract
or something like that.
In https://github.com/zio/zio-prelude/blob/9bbfa4fd23b85b67f58b71c46ff4f7c85ab243c4/src/main/scala/zio/prelude/Inverse.scala#L10-L16:
Based on the documentation and the trait's name, I would expect a function takes an
A
and return anA
- however, looking at the instances of this typeclass, it seems like the intention of this type class is a subtraction operation, and not inversion.