Skip to content

Use stronger wording about instability of hashable #300

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

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions hashable.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ name: hashable
version: 1.4.5.0
synopsis: A class for types that can be converted to a hash value
description:
This package defines a class, 'Hashable', for types that
can be converted to a hash value. This class
exists for the benefit of hashing-based data
structures. The package provides instances for
basic types and a way to combine hash values.
This package defines a class, 'Hashable', for types that can be converted to a hash value.
This class exists for the benefit of hashing-based data structures.
The package provides instances for basic types and a way to combine hash values.
.
The 'Hashable' 'hash' values are not guaranteed to be stable across library versions, operating systems or architectures. For stable hashing use named hashes: SHA256, CRC32 etc.
'Hashable' is intended exclusively for use in in-memory data structures.
.
'Hashable' does /not/ have a fixed standard.
This allows it to improve over time.
.
Because it does not have a fixed standard, different computers or computers on different versions of the code will observe different hash values.
As such, 'hashable' is not recommended for use other than in-memory datastructures.
Specifically, 'hashable' is not intended for network use or in applications which persist hashed values.
For stable hashing use named hashes: sha256, crc32, xxhash etc.

homepage: http://github.com/haskell-unordered-containers/hashable

license: BSD-3-Clause
license-file: LICENSE
author:
Expand Down Expand Up @@ -77,7 +82,7 @@ library
include-dirs: include
hs-source-dirs: src
build-depends:
base >=4.12.0.0 && <4.21
, base >=4.12.0.0 && <4.21
, bytestring >=0.10.8.2 && <0.13
, containers >=0.6.0.1 && <0.8
, deepseq >=1.4.4.0 && <1.6
Expand Down Expand Up @@ -159,7 +164,7 @@ test-suite hashable-tests
Regress

build-depends:
base
, base
, bytestring
, filepath
, ghc-prim
Expand Down Expand Up @@ -187,7 +192,7 @@ test-suite hashable-tests
test-suite hashable-examples
type: exitcode-stdio-1.0
build-depends:
base
, base
, ghc-prim
, hashable

Expand Down
12 changes: 9 additions & 3 deletions src/Data/Hashable/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,15 @@ infixl 0 `hashWithSalt`
--
-- Minimal implementation: 'hashWithSalt'.
--
-- /Note:/ the hash is not guaranteed to be stable across
-- library versions, operating systems or architectures.
-- For stable hashing use named hashes: SHA256, CRC32 etc.
-- 'Hashable' is intended exclusively for use in in-memory data structures.
-- .
-- 'Hashable' does /not/ have a fixed standard.
-- This allows it to improve over time.
-- .
-- Because it does not have a fixed standard, different computers or computers on different versions of the code will observe different hash values.
-- As such, 'Hashable' is not recommended for use other than in-memory datastructures.
-- Specifically, 'Hashable' is not intended for network use or in applications which persist hashed values.
-- For stable hashing use named hashes: sha256, crc32, xxhash etc.
--
-- If you are looking for 'Hashable' instance in @time@ package,
-- check [time-compat](https://hackage.haskell.org/package/time-compat)
Expand Down
Loading