The example code had a type mismatch.
Couldn't match expected type ‘State’
with actual type ‘CryptoFailable State’
In the second argument of ‘appendAAD’, namely ‘st1’
In the second argument of ‘($)’, namely ‘appendAAD hdr st1’
This is due to the following part:
let st1 = ChaChaPoly1305.initialize key nonce
st2 = ChaChaPoly1305.finalizeAAD $ ChaChaPoly1305.appendAAD hdr st1
`initialize` returns `CryptoFailable State`, not `State`.
This commit fixes the type mismatch, changes the return type of the
example function to `CryptoFailable ByteString`, and makes the code
to be immediately copy-and-paste-able.