bytes icon indicating copy to clipboard operation
bytes copied to clipboard

Comparing two `Byte` values always result in `True`, regardless of the actual bytes

Open malinoff opened this issue 6 years ago • 0 comments

> import Bytes.Encode
> b0 = [] |> List.map Bytes.Encode.unsignedInt8 |> Bytes.Encode.sequence |> Bytes.Encode.encode
<0 bytes> : Bytes.Bytes
> b1 = [ 125, 211, 143, 67, 78, 89, 125, 24, 100, 73, 61, 190, 172, 133, 160, 82, 150, 234, 82, 197, 97, 146, 67, 85, 53, 203, 134, 236, 168, 180, 179, 239 ] |> List.map Bytes.Encode.unsignedInt8 |> Bytes.Encode.sequence |> Bytes.Encode.encode
<32 bytes> : Bytes.Bytes
> (b0 == b1)
True : Bool

I'm not sure if it was ever intended to be able to compare two Bytes values, but the result of such comparison is very surprising.

malinoff avatar May 26 '19 13:05 malinoff