typelevel / typelevel/cats

Hash families

Open
#1,957 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
5.5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
5

Description

My Hash typeclass (#1712) is now merged into cats. As is discussed in #1712 , there is a need for a hash family typeclass that could be used in randomized data structures such as Bloom filters, CountMinSketches, etc.

I propose a hash family typeclass as follows:

trait HashFamily[A] { self =>

  def hash(x: A, i: Int): Int

  def ith(i: Int): Hash[A] = new Hash[A] {
    def hash(x: A) = self.hash(x, i)
  }

}

I wonder where this should go to. cats.kernel or cats.core?
I'd be happy to draft a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read issue #1712 first, then compare the responsibilities of cats.kernel and cats.core before proposing where HashFamily belongs. Confirm the typeclass API and placement with maintainers; done would be an agreed design and a merged implementation supporting randomized structures such as Bloom filters and CountMinSketches.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.