43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
--- Crypto.hs 2017-08-10 20:17:59.000000000 +0200
|
|
+++ Crypto.hs 2018-08-05 17:53:01.058720655 +0200
|
|
@@ -77,11 +77,11 @@
|
|
case Ed25519.publicKey pk of
|
|
CryptoPassed pk' -> SigVerifier 1 (Ed25519.verify pk')
|
|
CryptoFailed _ -> mempty
|
|
-
|
|
+instance Semigroup SigVerifier where
|
|
+ (SigVerifier na a) <> (SigVerifier nb b) =
|
|
+ SigVerifier (na+nb) $ \d s -> b d s || a d s
|
|
instance Monoid SigVerifier where
|
|
mempty = SigVerifier 0 $ \_b _s -> False
|
|
- mappend (SigVerifier na a) (SigVerifier nb b) =
|
|
- SigVerifier (na+nb) $ \d s -> b d s || a d s
|
|
|
|
data MySessionKey = MySessionKey Ed25519.SecretKey Ed25519.PublicKey
|
|
|
|
--- Types.hs 2017-08-10 20:17:59.000000000 +0200
|
|
+++ Types.hs 2018-08-05 17:51:29.435490869 +0200
|
|
@@ -194,9 +194,10 @@
|
|
mkElapsedTime :: POSIXTime -> POSIXTime -> ElapsedTime
|
|
mkElapsedTime start end = ElapsedTime $ fromRational $ toRational (end - start)
|
|
|
|
+instance Semigroup ElapsedTime where
|
|
+ (ElapsedTime a) <> (ElapsedTime b) = ElapsedTime (a+b)
|
|
instance Monoid ElapsedTime where
|
|
mempty = ElapsedTime 0
|
|
- mappend (ElapsedTime a) (ElapsedTime b) = ElapsedTime (a+b)
|
|
|
|
instance DataSize ElapsedTime where
|
|
dataSize _ = 16 -- 128 bit Double
|
|
--- Val.hs 2017-08-10 20:17:59.000000000 +0200
|
|
+++ Val.hs 2018-08-05 17:50:22.926328293 +0200
|
|
@@ -19,7 +19,7 @@
|
|
|
|
-- | Newtype of ByteString so we can have JSON instances without orphans.
|
|
newtype Val = Val { val :: B.ByteString }
|
|
- deriving (Show, Generic, Eq, Monoid)
|
|
+ deriving (Show, Generic, Eq, Monoid, Semigroup)
|
|
|
|
instance DataSize Val where
|
|
dataSize (Val b) = fromIntegral (B.length b)
|