-
Notifications
You must be signed in to change notification settings - Fork 4
/
hashabler.cabal
211 lines (183 loc) · 7.33 KB
/
hashabler.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: hashabler
version: 2.0.0
synopsis: Principled, portable & extensible hashing of data and types, including an implementation of the FNV-1a and SipHash algorithms.
description:
This package is a rewrite of the @hashable@ library by Milan Straka and
Johan Tibell, having the following goals:
.
- Extensibility; it should be easy to implement a new hashing algorithm on
any @Hashable@ type; in this package we provide SipHash and FNV-1a.
.
- Honest hashing of values, and principled hashing of algebraic data types
(see e.g. hashable issues #74 and #30)
.
- Cross-platform consistent hash values, with a versioning guarantee. Where
possible we ensure morally identical data hashes to indentical values
regardless of processor word size and endianness.
.
- Make implementing identical hash routines in other languages as painless
as possible. In addition to SipHash, we provide an implementation of a
simple hashing algorithm (FNV-1a) and make an effort to define Hashable
instances in a way that is well-documented and sensible, so that e.g. one
can easily implement a string hashing routine in JavaScript that will
match the way we hash strings here.
.
/Versioning/: Except for instances where we specifically note that we make
no promise of consistency, changes to hash values (and consequently changes
to @StableHashable@ values, where applicable) entail a major version number
bump.
homepage: https://github.com/jberryman/hashabler
license: BSD3
license-file: LICENSE
author: Brandon Simmons
maintainer: [email protected]
-- copyright:
category: Data
build-type: Simple
cabal-version: >=1.10
tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1, GHCJS == 0.2.0
-- For tests:
extra-source-files: tests/Vectors/generated/*.in
, tests/Vectors/generated/*.out.FNV32
-- cabal's wildcards are strange and sucky:
, tests/Vectors/generated/*.ByteString.out.FNV32
, tests/Vectors/generated/P.ByteArray.out.FNV32
, tests/Vectors/generated/*.Text.out.FNV32
, CHANGELOG.markdown
source-repository head
type: git
location: https://github.com/jberryman/hashabler.git
-- I guess we depend on impl(ghc) at this point, but maybe we can fix that
Flag integer-gmp
Description: Are we using integer-gmp to provide fast Integer instances? This is ignored when using ghcjs
Default: True
Flag dev
Description: To build tests, executables and benchmarks do `configure -fdev --enable-tests` and run the built executables by hand (i.e. not with `cabal test` etc.; we put all our different executables in test-suite sections in order to hide their dependencies from hackage)
Default: False
-- TODO did this solve our issues with having executable sections and hackage deps?:
Manual: True
Flag instrumented
Description: Enables assertions in library code. When --enable-library-profiling and --enable-executable-profiling is turned on, you can get stacktraces as well
Default: False
Manual: True
library
if flag(dev)
CPP-Options: -DEXPORT_INTERNALS
if flag(instrumented)
ghc-options: -fno-ignore-asserts
ghc-prof-options: -fprof-auto -auto-all -caf-all
exposed-modules: Data.Hashabler
other-modules: MachDeps, Data.Hashabler.Internal, Data.Hashabler.SipHash
build-depends: base >=4.6 && <5
, array >= 0.4
, bytestring
, text >= 1.1.1.3
, primitive
, ghc-prim
-- For endianness test:
, template-haskell
if impl(ghc < 7.9)
-- for Data.Functor.Identity
build-depends: transformers
if flag(integer-gmp) && !impl(ghcjs)
Build-depends: integer-gmp >= 0.2
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall -fwarn-tabs -O2 -funbox-strict-fields
-- I'm not sure how to make this test-suite and still be able to get
-- conditional export list in library:
test-suite tests
type: exitcode-stdio-1.0
default-language: Haskell2010
hs-source-dirs: tests
main-is: Main.hs
other-modules: Consistency
, Vectors.FNV
, Vectors.SipHash
ghc-options: -Wall -O2 -threaded -funbox-strict-fields -fno-ignore-asserts
if flag(instrumented)
CPP-Options: -DASSERTIONS_ON
if flag(dev)
buildable: True
build-depends: base
, hashabler
, directory
, bytestring
, text
, primitive
, random
, QuickCheck
if flag(integer-gmp) && !impl(ghcjs)
Build-depends: integer-gmp >= 0.2
else
buildable: False
benchmark bench
type: exitcode-stdio-1.0
default-language: Haskell2010
main-is: Main.hs
ghc-options: -Wall -O2 -threaded -funbox-strict-fields
hs-source-dirs: benchmarks
if flag(instrumented)
CPP-Options: -DASSERTIONS_ON
if flag(dev)
buildable: True
build-depends: base
, array >= 0.4
, bytestring
, text
, primitive
, hashabler
, hashable
, criterion
, deepseq
else
buildable: False
-- Some code to visualize distributions of hashes.
benchmark viz
type: exitcode-stdio-1.0
default-language: Haskell2010
main-is: Main.hs
ghc-options: -O2 -threaded -funbox-strict-fields
hs-source-dirs: viz
if flag(dev)
buildable: True
build-depends: base
, array >= 0.4
, bytestring
, text
, primitive
, JuicyPixels
, mwc-random
, vector
, hashabler
, hashable
else
buildable: False
-- For dumping core
benchmark core
type: exitcode-stdio-1.0
-- find dist/build/core/core-tmp -name '*dump-simpl'
if flag(dev)
buildable: True
build-depends:
base
, hashabler
, bytestring
else
buildable: False
if flag(dev)
ghc-options: -ddump-to-file -ddump-simpl -dsuppress-module-prefixes -dsuppress-uniques -ddump-core-stats -ddump-inlinings
ghc-options: -O2 -rtsopts -funbox-strict-fields
-- Either do threaded for eventlogging and simple timing...
--ghc-options: -threaded -eventlog
-- and run e.g. with +RTS -N -l
-- ...or do non-threaded runtime
--ghc-prof-options: -fprof-auto
--Relevant profiling RTS settings: -xt
-- TODO also check out +RTS -A10m, and look at output of -sstderr
-- hs-source-dirs: core-example
main-is: core.hs
default-language: Haskell2010
-- Testing bit-independence and avalanche properties of straight FNV-1a, as
-- well as experiments to validate the idea of using multiple parallel running
-- hashes to get more hash bits.