Skip to content

1.0.0.0

Latest
Compare
Choose a tag to compare
@emilypi emilypi released this 17 Sep 03:48
· 12 commits to master since this release
b6c393e

Changeset

Merged omnibus PR doing a variety of things in (#10):

  • Improves performance by 3-4x for encode, 4-5x for decode.

  • The decode signature returning the tuple and actually returns an error message with offset. The signature will now be ByteString -> Either String ByteString.

  • Actually tests using the test vectors defined in the RFC, and uses property tests to ensure invariants hold.

  • Adds lenient decoders to the API

  • Adds -XTrustworthy annotations to the relevant exposed modules

  • Rewrites the haddocks to be more up to date and fancy-styled.

  • Adds benchmarks to the .cabal file so they can be run at toplevel, and make them better.

  • Bumps the Cabal version to 1.12

Because of the breadth of this change, we are calling this a new epoch for the base16-bytestring library. Hence, the version 1.0.0.0.

Migration

The significant change in this release is the amendment to the decode function from ByteString -> (ByteString, ByteString) to ByteString -> Either String ByteString. The short list of conversions you can make to migrate to the new version is as follows:

If you have the following:

case Base16.decode foo of
  (bs, "") -> ...
  (_,_) -> ...

You can immediately change this to be

case Base16.decode foo of
  Right bs -> ...
  Left{} -> ...

If you have a case that matches

  (bs, bs) | bs /= BS.empty -> 

Then you should switch to using the lenient decoding function, or use the offset given by the decode error to split the bytestring at that index.