From the documentation for bit in Data.Bits, it seems thatbit should set the ith bit set and all other bits clear.
It seems that when i >= 8 this library is setting the first byte correctly but then all later bits are set instead of clear.
Prelude BS> import qualified Data.ByteString.Base16 as B16
Prelude BS B16> import Data.Bits
Prelude BS B16 Data.Bits> import Data.Bits.ByteString
Prelude BS B16 Data.Bits Data.Bits.ByteString> B16.encode . bit 8
Prelude BS B16 Data.Bits Data.Bits.ByteString> B16.encode . bit $ 8
"01ff"
I think that the last line should return 0100 rather than 01ff
From the documentation for
bitin Data.Bits, it seems thatbitshould set the ith bit set and all other bits clear.It seems that when i >= 8 this library is setting the first byte correctly but then all later bits are set instead of clear.
I think that the last line should return 0100 rather than 01ff