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

Remove conversion from Hash to Hashing #2120

Closed
ctongfei opened this issue Dec 19, 2017 · 2 comments
Closed

Remove conversion from Hash to Hashing #2120

ctongfei opened this issue Dec 19, 2017 · 2 comments

Comments

@ctongfei
Copy link
Contributor

ctongfei commented Dec 19, 2017

scala.util.hashing.Hashing[A] presupposes universal equality using == -- a == b implies hash(a) == hash(b).
cats.kernel.Hash[A]'s underlying eqv is based upon cats.kernel.Eq which is customizable -- eqv(a, b) implies hash(a) == hash(b).
One cannot convert a cats.kernel.Hash[A] to scala.util.hashing.Hashing[A] without compromising the typeclass instance's semantics.
@kailuowang #2116

@kailuowang
Copy link
Contributor

@ctongfei thanks for point it out. We had a discussion with @denisrosset in #2116, according the scala API doc

Note: when using a custom Hashing, make sure to use it with the Equiv such that if any two objects are equal, then their hash codes must be equal.

So it seems that we should be able to convert Hash to Hashing and Eq to Eqiv?

@ctongfei
Copy link
Contributor Author

Thanks @kailuowang for pointing out that. I agree with your justification.

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

No branches or pull requests

2 participants