summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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