-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add InjectionK and BijectionK #271
Comments
I think this is a great idea. Of course, I will likely not get to it very soon. Something like: trait BijectionK[F[_], G[_]] {
def apply[A](f: F[A]): G[A]
def invert[A](g: G[A]): F[A]
def toBijection[A]: Bijection[F[A], G[A]]
}
trait InjectionK[F[_], G[_]] {
def apply[A](f: F[A]): G[A]
def invert[A](g: G[A]): Try[F[A]]
def toInjection[A]: Injection[F[A], G[A]]
} and of course laws. Maybe add |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cats have InjectionK but their
invert
function returnsOption[F[_]]
which they are unwilling to change. It would nice to have InjectionK withinvert
defined asTry[F[_]]
as we have for all our existing injections. WhileOption[F[_]]
maybe more theoretically correct, I have foundTry[F[_]]
to be more useful as I usually want to do something with he exception when inversion fails!. We would also needFunctionK
as wellThe text was updated successfully, but these errors were encountered: