diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-18 12:27:58 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-18 12:27:58 -0400 |
commit | 9d1c9bcf99e4b5dc4f3c0ede46bcda84203bfeac (patch) | |
tree | fd443fb461fba96d5316d74ec396cb1873ecea98 | |
parent | 5b37ab893db9f7f4510dd03944271aa583ba83e2 (diff) | |
download | debug-me-9d1c9bcf99e4b5dc4f3c0ede46bcda84203bfeac.tar.gz |
improve
-rw-r--r-- | Hash.hs | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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 |