summaryrefslogtreecommitdiffhomepage
path: root/Hash.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-18 12:27:58 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-18 12:27:58 -0400
commit9d1c9bcf99e4b5dc4f3c0ede46bcda84203bfeac (patch)
treefd443fb461fba96d5316d74ec396cb1873ecea98 /Hash.hs
parent5b37ab893db9f7f4510dd03944271aa583ba83e2 (diff)
downloaddebug-me-9d1c9bcf99e4b5dc4f3c0ede46bcda84203bfeac.tar.gz
improve
Diffstat (limited to 'Hash.hs')
-rw-r--r--Hash.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/Hash.hs b/Hash.hs
index 9b5fa80..ed4513b 100644
--- a/Hash.hs
+++ b/Hash.hs
@@ -35,10 +35,8 @@ instance Hashable a => Hashable (Tagged a) where
hash (Tagged b a) = hash [hash b, hash a]
instance Hashable a => Hashable (Activity a) where
- hash (Activity a (Just p) s) = hash $ Tagged "Activity"
- [hash a, hash p, hash s]
- hash (Activity a Nothing s) = hash $ Tagged "Activity"
- [hash a, hash (), hash s]
+ hash (Activity a mp s) = hash $ Tagged "Activity"
+ [hash a, hash mp, hash s]
instance Hashable a => Hashable (Proto a) where
hash (Proto a) = hash $ Tagged "Proto" a
@@ -58,6 +56,7 @@ instance Hashable Signature where
instance Hashable [Hash] where
hash = hash . B.concat . map (val . hashValue)
--- | Hash empty string for ()
-instance Hashable () where
- hash () = hash (mempty :: B.ByteString)
+-- | Hash empty string for Nothing
+instance Hashable v => Hashable (Maybe v) where
+ hash Nothing = hash (mempty :: B.ByteString)
+ hash (Just v) = hash v