diff --git a/core/src/main/scala/cats/instances/hash.scala b/core/src/main/scala/cats/instances/hash.scala index 443ef96e394..2401313148a 100644 --- a/core/src/main/scala/cats/instances/hash.scala +++ b/core/src/main/scala/cats/instances/hash.scala @@ -2,7 +2,7 @@ package cats package instances -trait HashInstances { +trait HashInstances extends kernel.instances.HashInstances { implicit val catsContravariantForHash: Contravariant[Hash] = new Contravariant[Hash] { diff --git a/kernel/src/main/scala/cats/kernel/Hash.scala b/kernel/src/main/scala/cats/kernel/Hash.scala index ef8e88d742a..4579f121848 100644 --- a/kernel/src/main/scala/cats/kernel/Hash.scala +++ b/kernel/src/main/scala/cats/kernel/Hash.scala @@ -54,3 +54,9 @@ object Hash extends HashFunctions[Hash] { } } + +trait HashToHashingConversion { + implicit def catsKernelHashToHashing[A](implicit ev: Hash[A]): Hashing[A] = new Hashing[A] { + override def hash(x: A): Int = ev.hash(x) + } +} diff --git a/kernel/src/main/scala/cats/kernel/instances/all.scala b/kernel/src/main/scala/cats/kernel/instances/all.scala index 1b5866c7c18..1af2f0b0dad 100644 --- a/kernel/src/main/scala/cats/kernel/instances/all.scala +++ b/kernel/src/main/scala/cats/kernel/instances/all.scala @@ -16,6 +16,7 @@ trait AllInstances with DurationInstances with FloatInstances with FunctionInstances + with HashInstances with IntInstances with ListInstances with LongInstances diff --git a/kernel/src/main/scala/cats/kernel/instances/hash.scala b/kernel/src/main/scala/cats/kernel/instances/hash.scala new file mode 100644 index 00000000000..38220965962 --- /dev/null +++ b/kernel/src/main/scala/cats/kernel/instances/hash.scala @@ -0,0 +1,6 @@ +package cats.kernel +package instances + +trait HashInstances extends HashToHashingConversion + +object hash extends HashInstances