Skip to content

Commit 17fe6ed

Browse files
committed
instance
1 parent 4257255 commit 17fe6ed

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Simplex/Messaging/Notifications/Protocol.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,13 @@ toWPAuth s
470470
newtype WPP256dh = WPP256dh ECC.PublicPoint
471471
deriving (Eq, Show)
472472

473+
-- This Ord instance for ECC point is quite arbitrary, it is needed because token is used as Map key
473474
instance Ord WPP256dh where
474-
compare (WPP256dh p1) (WPP256dh p2) = comparePt p1 p2
475-
where
476-
comparePt ECC.PointO ECC.PointO = EQ
477-
comparePt ECC.PointO (ECC.Point _ _) = LT
478-
comparePt (ECC.Point _ _) ECC.PointO = GT
479-
comparePt (ECC.Point x1 y1) (ECC.Point x2 y2) = compare (x1, y1) (x2, y2)
475+
compare (WPP256dh p1) (WPP256dh p2) = case (p1, p2) of
476+
(ECC.PointO, ECC.PointO) -> EQ
477+
(ECC.PointO, _) -> GT
478+
(_, ECC.PointO) -> LT
479+
(ECC.Point x1 y1, ECC.Point x2 y2) -> compare (x1, y1) (x2, y2)
480480

481481
data WPKey = WPKey
482482
{ wpAuth :: WPAuth,

0 commit comments

Comments
 (0)