summaryrefslogtreecommitdiff
path: root/src/Identity.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Identity.hs')
-rw-r--r--src/Identity.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Identity.hs b/src/Identity.hs
index b81228f..834e5ee 100644
--- a/src/Identity.hs
+++ b/src/Identity.hs
@@ -52,8 +52,8 @@ deriving instance Show (m (Stored (Signed IdentityData))) => Show (Identity m)
type ComposedIdentity = Identity []
type UnifiedIdentity = Identity I.Identity
-instance Eq UnifiedIdentity where
- (==) = (==) `on` (idData &&& idUpdates)
+instance Eq (m (Stored (Signed IdentityData))) => Eq (Identity m) where
+ (==) = (==) `on` (idData_ &&& idUpdates_)
data IdentityData = IdentityData
{ iddPrev :: [Stored (Signed IdentityData)]
@@ -79,6 +79,11 @@ instance Storable IdentityData where
<*> loadRef "key-id"
<*> loadMbRef "key-msg"
+instance Mergeable (Maybe ComposedIdentity) where
+ type Component (Maybe ComposedIdentity) = Signed IdentityData
+ mergeSorted = validateIdentityF
+ toComponents = maybe [] idDataF
+
idData :: UnifiedIdentity -> Stored (Signed IdentityData)
idData = I.runIdentity . idDataF