Explicitly convert a (lazy) ByteString to a Text value using UTF-8 encoding, throwing a GraphvizException if there is a decoding error.
Modulegraphviz-2999.20.2.1Haskell2010
Data.GraphViz.Commands.IO
Various utility functions to help with custom I/O of Dot code.
Contents
Synopsis
- value toUTF8
- value writeDotFile
- value readDotFile
- value hPutDot
- value hPutCompactDot
- value hGetDot
- value hGetStrict
- value putDot
- value readDot
- value runCommand
- Packagegraphviz-2999.20.2.1
- Exports10
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceIO.hs
Encoding
By default, Dot code should be in UTF-8. However, by usage of the charset attribute, users are able to specify that the ISO-8859-1 (aka Latin1) encoding should be used instead: http://www.graphviz.org/doc/info/attrs.html#d:charset
To simplify matters, graphviz does not work with ISO-8859-1. If you wish to deal with existing Dot code that uses this encoding, you will need to manually read that file in to a Text value.
If a non-UTF-8 encoding is used, then a GraphvizException will be thrown.
Operations on files
Write the specified DotRepr to file.
Read in and parse a DotRepr value from a file.
Operations on handles
Output the DotRepr to the specified Handle.
Output the DotRepr to the spcified Handle in a more compact,
machine-oriented form.
Read in and parse a DotRepr value from the specified Handle.
Strictly read in a Text value using an appropriate encoding.
Special cases for standard input and output
Print the specified DotRepr to stdout.
Read in and parse a DotRepr value from stdin.
Running external commands
runCommand Run an external command on the specified DotRepr. Remember to
use hSetBinaryMode on the Handle for the output function if
necessary.
If the command was unsuccessful, then a GraphvizException is thrown.
For performance reasons, a temporary file is used to store the generated Dot code. As such, this is only suitable for local commands.