diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-04-05 22:03:43 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-04-05 22:03:43 +0200 |
commit | 7a9ef992afa96ed177ae9a4a67d302017ab73852 (patch) | |
tree | 4c53058ce2ae8015db653326996bfc17a906e72e /src/Pairing.hs | |
parent | a8893fbcfa06044e7f999916c4dcc6a2dc907f75 (diff) |
Fix non-exhaustive pattern match warnings
Diffstat (limited to 'src/Pairing.hs')
-rw-r--r-- | src/Pairing.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Pairing.hs b/src/Pairing.hs index a264c42..8567168 100644 --- a/src/Pairing.hs +++ b/src/Pairing.hs @@ -195,9 +195,11 @@ nonceDigest idReq idRsp nonceReq nonceRsp = hashToRefDigest $ serializeObject $ ] confirmationNumber :: RefDigest -> String -confirmationNumber dgst = let (a:b:c:d:_) = map fromIntegral $ BA.unpack dgst :: [Word32] - str = show $ ((a `shift` 24) .|. (b `shift` 16) .|. (c `shift` 8) .|. d) `mod` (10 ^ len) - in replicate (len - length str) '0' ++ str +confirmationNumber dgst = + case map fromIntegral $ BA.unpack dgst :: [Word32] of + (a:b:c:d:_) -> let str = show $ ((a `shift` 24) .|. (b `shift` 16) .|. (c `shift` 8) .|. d) `mod` (10 ^ len) + in replicate (len - length str) '0' ++ str + _ -> "" where len = 6 pairingRequest :: forall a m proxy. (PairingResult a, MonadIO m, MonadError String m) => proxy a -> Peer -> m () |