haskell / base16-bytestring

Fast base16 (hexadecimal) encoding and decoding for Haskell bytestrings.
Other
27 stars 10 forks source link

Lazy decoding is not lazy when decoding fails #5

Closed chris-martin closed 6 years ago

chris-martin commented 6 years ago

Lazy decoding is lazy when successful:

λ> (B.unpack . B.take 8 . fst . B.decode) (B.iterate id 48)
[0,0,0,0,0,0,0,0]

But it is not lazy when there is a decoding failure:

λ> (B.unpack . B.take 8 . fst . B.decode) (B.iterate id 47)

I would expect this second example to produce [], but it never terminates.