Encode

Please read the Dhall.Tutorial module, which contains a tutorial explaining how to use the language, the compiler, and this library
Unicode aware URI encoding and decoding functions for both String and Text. Although standards are pretty vague about Unicode in URIs most browsers are pretty straightforward when encoding URIs: Encode a text to a UTF-8 string and URI-encode every individual byte (not character).
DNS message encoder. Note: DNS is a client library, and its focus is on sending queries, and receiving replies. Thefore, while this module is reasonably adept at query generation, building a DNS server with this module requires additional work to handle message size limits, correct UDP truncation, proper EDNS negotiation, and so on. Support for server-side DNS is at best rudimentary. For sending queries, in most cases you should be using one of the functions from Lookup and LookupRaw, or lastly, if you want to handle the network reads and writes for yourself (with your own code for UDP retries, TCP fallback, EDNS fallback, ...), then perhaps encodeQuestion (letting DNS do the lookups for you in an async thread is likely much simpler).
Most users of this library do not need this module. The functions here are used to build functions that apply a Colonnade to a collection of values, building a table from them. Ultimately, a function that applies a Colonnade Headed MyCell a to data will have roughly the following type:
myTableRenderer :: Foldable g => Colonnade Headed MyCell a -> g a -> MyContent
In the companion packages yesod-colonnade and reflex-dom-colonnade, functions with similar type signatures are readily available. These packages use the functions provided here in the implementations of their rendering functions. It is recommended that users who believe they may need this module look at the source of the companion packages to see an example of how this module's functions are used. Other backends are encouraged to use these functions to build monadic or monoidal content from a Colonnade. The functions exported here take a Colonnade and convert it to a fragment of content. The functions whose names start with row take at least a Colonnade f c a and an a value to generate a row of content. The functions whose names start with header need the Colonnade f c a but not an a value since a value is not needed to build a header.
Adhoc encoder
Provide a custom way to encode a particular file format. This is an alternative approach to Writable class
Not on Stackage, so not searched. Encoding character data
Functions in this module serve as an alternative ToJSON type class. This allows to define for mapping from data type into multiple JSON representations. type level wrapping. There are two way of defining such encoder:
  • Using simple function a -> Value which doesn't require this library
  • Using this library as DSL together with Contravariant
Efficiently serialize a JSON value as a lazy ByteString. This is implemented in terms of the ToJSON class's toEncoding method.
Encode a value using binary serialisation to a lazy ByteString.
Encode a Haskell String to a list of Word8 values, in UTF8 format.
Encode a value using binary serialization to a strict ByteString.
Encode a string into base64 form. The result will always be a multiple of 4 bytes in length.
Encode a string into base64url form. The result will always be a multiple of 4 bytes in length.
Encode a value into its YAML representation.
Convert text into bytes, using the provided codec. If the codec is not capable of representing an input character, an exception will be thrown. Since 0.3.0
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"