remove the need to have same length arguments in bytesEq. bail early in case strings have different size.
This commit is contained in:
parent
9b32e6d5f4
commit
d0481f76a3
1 changed files with 4 additions and 2 deletions
|
@ -59,6 +59,8 @@ False &&! False = False
|
|||
|
||||
-- | verify that 2 bytestrings are equals.
|
||||
-- it's a non lazy version, that will compare every bytes.
|
||||
-- arguments need to be of same length
|
||||
-- arguments with different length will bail out early
|
||||
bytesEq :: Bytes -> Bytes -> Bool
|
||||
bytesEq b1 = and' . B.zipWith (==) b1
|
||||
bytesEq b1 b2
|
||||
| B.length b1 /= B.length b2 = False
|
||||
| otherwise = and' $ B.zipWith (==) b1 b2
|
||||
|
|
Loading…
Reference in a new issue