[GHC] #4108: GHC.Integer.hashInteger is a misnomer and confuses
people
GHC
cvs-ghc at haskell.org
Wed Jun 2 05:23:03 EDT 2010
#4108: GHC.Integer.hashInteger is a misnomer and confuses people
---------------------------+------------------------------------------------
Reporter: duncan | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.12.2
Resolution: | Keywords:
Difficulty: | Os: Unknown/Multiple
Testcase: | Architecture: Unknown/Multiple
Failure: None/Unknown |
---------------------------+------------------------------------------------
Changes (by simonmar):
* status: closed => new
* resolution: invalid =>
Comment:
Replying to [comment:3 duncan]:
> The new `berp` package uses it (but will stop using it in the next
release). The author did not realise that `GHC.Integer.hashInteger` is
basically the identity function and would not have used it if they had
known.
Why's that, just out of interest?
> By comparison, `Data.HashTable.hashInt` is not an identity. I defer to
Eric that perhaps the existing `hashInteger` could be usable as a hash
function in some circumstances. It does however seem a bit special-purpose
to use that name, and it could be named something less misleading.
It's probably not a great hash function, in the same way that (`mod`
power-of-2) is not a great hash function either (disclaimer: I'm not an
expert on hash functions), because it's too easy to construct a collection
of values that have the same hash. So at least we ought to add something
to the documentation to say what the function does.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4108#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list