Encode a ByteString value in base16 (i.e. hexadecimal). Encoded values will always have a length that is a multiple of 2.
Examples:
encode "foo" == "666f6f":: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulebase16-bytestring-1.0.2.0Haskell2010
RFC 4648-compliant Base16 (Hexadecimal) encoding for lazy ByteString values. For a complete Base16 encoding specification, please see RFC-4648 section 8.
Encode a ByteString value in base16 (i.e. hexadecimal). Encoded values will always have a length that is a multiple of 2.
encode "foo" == "666f6f"Decode a base16-encoded ByteString value.
If errors are encountered during the decoding process,
then an error message and character offset will be returned in
the Left clause of the coproduct.
decode "666f6f" == Right "foo"
decode "66quux" == Left "invalid character at offset: 2"
decode "666quu" == Left "invalid character at offset: 3"Decode a Base16-encoded ByteString value leniently, using a strategy that never fails.
N.B.: this is not RFC 4648-compliant
decodeLenient "666f6f" == "foo"
decodeLenient "66quux" == "f"
decodeLenient "666quu" == "f"
decodeLenient "666fqu" == "fo"