diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-19 17:30:32 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-19 17:45:14 -0400 |
commit | 6f7cf857b408401abdc4477c888495b4f13162c7 (patch) | |
tree | 5b746c171df6e68864b2bbaacf2e833587832367 /Hash.hs | |
parent | 951d165bc27b9397174af1d826366e39cdbd53dd (diff) | |
download | debug-me-6f7cf857b408401abdc4477c888495b4f13162c7.tar.gz |
reorganized message types
Make Control messages be out-of-band async messages, without a pointer
to a previous message.
And then followed the type change through the code for hours..
This commit was sponsored by Nick Daly on Patreon.
Diffstat (limited to 'Hash.hs')
-rw-r--r-- | Hash.hs | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -38,10 +38,6 @@ instance Hashable a => Hashable (Activity a) where 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 - hash (Rejected a) = hash $ Tagged "Rejected" (hash a) - instance Hashable Entered where hash v = hash $ Tagged "Entered" [hash (enteredData v), hash (echoData v)] @@ -50,8 +46,15 @@ instance Hashable Seen where hash v = hash $ Tagged "Seen" [hash (seenData v)] instance Hashable Signature where - hash (Ed25519 s) = hash $ Tagged "Ed25519" s - hash Unsigned = hash $ Tagged "Unsigned" (mempty :: B.ByteString) + hash (Ed25519Signature s) = hash $ Tagged "Ed25519Signature" s + hash (OtherSignature s) = hash $ Tagged "OtherSignature" s + +instance Hashable PublicKey where + hash (PublicKey v gpgsig) = hash $ Tagged "PublicKey" + [hash v, hash gpgsig] + +instance Hashable GpgSig where + hash (GpgSig v) = hash $ Tagged "GpgSig" v -- | Hash a list of hashes by hashing the concacenation of the hashes. instance Hashable [Hash] where @@ -59,5 +62,8 @@ instance Hashable [Hash] where -- | Hash empty string for Nothing instance Hashable v => Hashable (Maybe v) where - hash Nothing = hash (mempty :: B.ByteString) + hash Nothing = hash () hash (Just v) = hash v + +instance Hashable () where + hash () = hash (mempty :: B.ByteString) |