base-encoding-0.2.0.0: Binary-to-text encodings (e.g. base64)

Safe HaskellTrustworthy
LanguageHaskell2010

Codec.Base16

Description

This module provides access to the "base16" binary-to-text encoding as defined by RFC 4648.

This module is intended to be imported qualified, e.g.

import qualified Codec.Base16 as B16

If you want to explictly specify which Encode and Decode typeclass instance is used, you can use plain Haskell2010 type-signature annotations, e.g.

>>> (B16.encode :: ByteString -> Text) "\202\254"
"cafe"
>>> (B16.decode :: Text -> Either String ShortByteString) "CaFe"
Right "\202\254"

Alternatively, starting with GHC 8.0.1, you can also use the TypeApplications language extension:

>>> B16.encode @ShortByteString @Text "\xFF\239\0"
"ffef00"
>>> B16.decode @Text @ShortByteString ""
Right ""

Since: 0.1.0.0

Synopsis

Documentation

class Encode bin txt where Source #

Typeclass representing types for which a binary-to-text base16 encoding is defined

Methods

encode :: bin -> txt Source #

Encode binary data using base16 text encoding

Instances
Encode ShortByteString ShortByteString Source # 
Instance details

Defined in Codec.Base16

Encode ShortByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Encode ShortByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Encode ShortByteString Builder Source # 
Instance details

Defined in Codec.Base16

Encode ShortByteString Builder Source # 
Instance details

Defined in Codec.Base16

Encode ShortByteString Text Source # 
Instance details

Defined in Codec.Base16

Encode ShortByteString Text Source # 
Instance details

Defined in Codec.Base16

Encode ByteString ShortByteString Source # 
Instance details

Defined in Codec.Base16

Encode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Encode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Builder Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Builder Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Text Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Text Source # 
Instance details

Defined in Codec.Base16

Encode ByteString ShortByteString Source # 
Instance details

Defined in Codec.Base16

Encode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Encode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Builder Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Builder Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Text Source # 
Instance details

Defined in Codec.Base16

Encode ByteString Text Source # 
Instance details

Defined in Codec.Base16

Encode Builder ShortByteString Source # 
Instance details

Defined in Codec.Base16

Encode Builder ByteString Source # 
Instance details

Defined in Codec.Base16

Encode Builder ByteString Source # 
Instance details

Defined in Codec.Base16

Encode Builder Builder Source # 
Instance details

Defined in Codec.Base16

Encode Builder Builder Source # 
Instance details

Defined in Codec.Base16

Encode Builder Text Source # 
Instance details

Defined in Codec.Base16

Methods

encode :: Builder -> Text Source #

Encode Builder Text Source # 
Instance details

Defined in Codec.Base16

Methods

encode :: Builder -> Text Source #

class Decode txt bin where Source #

Typeclass representing types for which a text-to-binary base16 decoding is defined

Methods

decode :: txt -> Either String bin Source #

Decode binary data encoded textually as base16

Instances
Decode ShortByteString ShortByteString Source # 
Instance details

Defined in Codec.Base16

Decode ShortByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Decode ShortByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Decode ShortByteString Builder Source # 
Instance details

Defined in Codec.Base16

Decode ByteString ShortByteString Source # 
Instance details

Defined in Codec.Base16

Decode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Decode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Decode ByteString Builder Source # 
Instance details

Defined in Codec.Base16

Decode ByteString ShortByteString Source # 
Instance details

Defined in Codec.Base16

Decode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Decode ByteString ByteString Source # 
Instance details

Defined in Codec.Base16

Decode ByteString Builder Source # 
Instance details

Defined in Codec.Base16

Decode Builder ShortByteString Source # 
Instance details

Defined in Codec.Base16

Decode Builder ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Builder ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Builder Builder Source # 
Instance details

Defined in Codec.Base16

Decode Builder ShortByteString Source # 
Instance details

Defined in Codec.Base16

Decode Builder ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Builder ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Builder Builder Source # 
Instance details

Defined in Codec.Base16

Decode Text ShortByteString Source # 
Instance details

Defined in Codec.Base16

Decode Text ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Text ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Text Builder Source # 
Instance details

Defined in Codec.Base16

Decode Text ShortByteString Source # 
Instance details

Defined in Codec.Base16

Decode Text ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Text ByteString Source # 
Instance details

Defined in Codec.Base16

Decode Text Builder Source # 
Instance details

Defined in Codec.Base16