Serialize YAML Node(s) using the YAML 1.2 Core schema to a lazy
UTF8 encoded
ByteString.
Each YAML Node produces exactly one YAML Document.
Here is an example of encoding a list of strings to produce a list of
YAML Documents
>>> encode (["Document 1", "Document 2"] :: [Text])
"Document 1\n...\nDocument 2\n"
If we treat the above list of strings as a single sequence then we
will produce a single YAML Document having a single sequence.
>>> encode ([["Document 1", "Document 2"]] :: [[Text]])
"- Document 1\n- Document 2\n"
Alternatively, if you only need a single YAML document in a YAML
stream you might want to use the convenience function
encode1;
or, if you need more control over the encoding, see
encodeNode'.