diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2017-05-10 08:58:58 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-05-10 08:58:58 -0700 |
commit | a526f69d0e2908bdae2ff17a63641914c86547c3 (patch) | |
tree | a8306453ea5ecae78cc1528e95437dd307ab1cf7 /doc/protocol | |
parent | c9d198ffa9d2719b83c07f5157e735dad801bb4e (diff) | |
parent | bb15464e4218ff3209b6312e0795f60689613a2c (diff) | |
download | debug-me-a526f69d0e2908bdae2ff17a63641914c86547c3.tar.gz |
Merge tag '1.20170509'
tagging package debug-me version 1.20170509
Diffstat (limited to 'doc/protocol')
3 files changed, 51 insertions, 0 deletions
diff --git a/doc/protocol/comment_1_44d3ac18bf10c1644a73855c01868ab3._comment b/doc/protocol/comment_1_44d3ac18bf10c1644a73855c01868ab3._comment new file mode 100644 index 0000000..64eed07 --- /dev/null +++ b/doc/protocol/comment_1_44d3ac18bf10c1644a73855c01868ab3._comment @@ -0,0 +1,19 @@ +[[!comment format=mdwn + username="https://www.joachim-breitner.de/" + nickname="nomeata" + avatar="http://cdn.libravatar.org/avatar/a2112893817513537c6a2c228c04c138a2f68bba57121ab7f267de58fc5171d7" + subject="Code smell in hashing" + date="2017-05-05T23:51:14Z" + content=""" +Hi Joey, + +I looked through http://source.debug-me.branchable.com/?p=source.git;a=blob;f=Hash.hs;hb=HEAD and since this probably scurity-relevant, allow me to be nitpicky: + +``` +instance Hashable v => Hashable (Maybe v) where + hash Nothing = hash () + hash (Just v) = hash v +``` + +will hash the distinct values `Just ()` and `Nothing` identically. Maybe you don't have any `Maybe ()` type around, but in that case you should maybe document that requirement. +"""]] diff --git a/doc/protocol/comment_2_4a25b8ee6e438a031e875078ffb1d125._comment b/doc/protocol/comment_2_4a25b8ee6e438a031e875078ffb1d125._comment new file mode 100644 index 0000000..935570d --- /dev/null +++ b/doc/protocol/comment_2_4a25b8ee6e438a031e875078ffb1d125._comment @@ -0,0 +1,10 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 2""" + date="2017-05-06T01:34:39Z" + content=""" +Thanks for that review. That would indeed be bad. To avoid that +potential problem, I've specialized the instance to +`Hashable (Maybe Hash)`, which is the only Maybe value that currently +needs to be hashed. +"""]] diff --git a/doc/protocol/comment_3_6338e14886f146eb5d2f9c9316e1f7de._comment b/doc/protocol/comment_3_6338e14886f146eb5d2f9c9316e1f7de._comment new file mode 100644 index 0000000..657a20a --- /dev/null +++ b/doc/protocol/comment_3_6338e14886f146eb5d2f9c9316e1f7de._comment @@ -0,0 +1,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) + +"""]] |