File: comment_3_6338e14886f146eb5d2f9c9316e1f7de._comment

package info (click to toggle)
debug-me 1.20181208-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 680 kB
  • sloc: haskell: 3,134; sh: 115; makefile: 80
file content (22 lines) | stat: -rw-r--r-- 652 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[[!comment format=mdwn
 username="https://www.joachim-breitner.de/"
 nickname="nomeata"
 avatar="http://cdn.libravatar.org/avatar/a2112893817513537c6a2c228c04c138a2f68bba57121ab7f267de58fc5171d7"
 subject="comment 3"
 date="2017-05-07T03:20:38Z"
 content="""
Still not good, I think, as the instance `Hashable Hash` has `hash = id`, so

       hash Nothing
    = hash ()
    = id (hash ())
    = hash (Just (hash ())

 and we have a collision at type `Maybe Hash`.

What would work is to do the same that `Hashable []` does, i.e. has the hash again:

    hash (Just v) = hash (val (hashValue v))
    hash Nothing = hash (mempty :: B.ByteString)

"""]]