graphviz-2999.20.0.2: Bindings to Graphviz for graph visualisation.

Copyright(c) Ivan Lazar Miljenovic
License3-Clause BSD-style
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone
LanguageHaskell2010

Data.GraphViz.Printing

Description

This module defines simple helper functions for use with Text.PrettyPrint. It also re-exports all the pretty-printing combinators from that module.

Note that the PrintDot instances for Bool, etc. match those specified for use with Graphviz.

You should only be using this module if you are writing custom node types for use with Data.GraphViz.Types. For actual printing of code, use printDotGraph (which produces a Text value).

The Dot language specification specifies that any identifier is in one of four forms:

  • Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores ('_') or digits ([0-9]), not beginning with a digit;
  • a number [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? );
  • any double-quoted string ("...") possibly containing escaped quotes (\");
  • an HTML string (<...>).

(Note that the first restriction is referring to a byte-by-byte comparison using octal values; when using UTF-8 this corresponds to all characters c where ord c >= 128.)

Due to these restrictions, you should only use text when you are sure that the Text in question is static and quotes are definitely needed/unneeded; it is better to use the Text instance for PrintDot. For more information, see the specification page: http://graphviz.org/doc/info/lang.html

Synopsis

Documentation

data DotCodeM a Source #

A type alias to indicate what is being produced.

renderDot :: DotCode -> Text Source #

Correctly render Graphviz output.

class PrintDot a where Source #

A class used to correctly print parts of the Graphviz Dot language. Minimal implementation is unqtDot.

Minimal complete definition

unqtDot

Methods

unqtDot :: a -> DotCode Source #

The unquoted representation, for use when composing values to produce a larger printing value.

toDot :: a -> DotCode Source #

The actual quoted representation; this should be quoted if it contains characters not permitted a plain ID String, a number or it is not an HTML string. Defaults to unqtDot.

unqtListToDot :: [a] -> DotCode Source #

The correct way of representing a list of this value when printed; not all Dot values require this to be implemented. Defaults to Haskell-like list representation.

listToDot :: [a] -> DotCode Source #

The quoted form of unqtListToDot; defaults to wrapping double quotes around the result of unqtListToDot (since the default implementation has characters that must be quoted).

Instances

PrintDot Bool Source # 
PrintDot Char Source # 
PrintDot Double Source # 
PrintDot Int Source # 
PrintDot Integer Source # 
PrintDot Word8 Source # 
PrintDot Word16 Source # 
PrintDot Version Source #

Ignores versionTags and assumes 'not . null . versionBranch' (usually you want 'length . versionBranch == 2').

PrintDot Text Source # 
PrintDot Text Source # 
PrintDot BrewerName Source # 
PrintDot BrewerScheme Source # 
PrintDot ColorScheme Source # 
PrintDot GraphvizCommand Source # 
PrintDot CompassPoint Source # 
PrintDot PortPos Source # 
PrintDot PortName Source # 
PrintDot X11Color Source # 
PrintDot SVGColor Source # 
PrintDot WeightedColor Source # 
PrintDot Color Source # 
PrintDot Style Source # 
PrintDot Side Source # 
PrintDot Scale Source # 
PrintDot CellFormat Source # 
PrintDot VAlign Source # 
PrintDot Align Source # 
PrintDot Attribute Source # 
PrintDot Img Source # 
PrintDot Cell Source # 
PrintDot Row Source # 
PrintDot Table Source # 
PrintDot Format Source # 
PrintDot TextItem Source # 
PrintDot Label Source # 
PrintDot NodeSize Source # 
PrintDot Normalized Source # 
PrintDot Number Source # 
PrintDot Ratios Source # 
PrintDot Justification Source # 
PrintDot ScaleType Source # 
PrintDot Paths Source # 
PrintDot VerticalPlacement Source # 
PrintDot FocusType Source # 
PrintDot ViewPort Source # 
PrintDot StyleName Source # 
PrintDot StyleItem Source # 
PrintDot STStyle Source # 
PrintDot StartType Source # 
PrintDot SmoothType Source # 
PrintDot Shape Source # 
PrintDot RankDir Source # 
PrintDot RankType Source # 
PrintDot Root Source # 
PrintDot QuadType Source # 
PrintDot Spline Source # 
PrintDot PageDir Source # 
PrintDot EdgeType Source # 
PrintDot Pos Source # 
PrintDot PackMode Source # 
PrintDot Pack Source # 
PrintDot OutputMode Source # 
PrintDot Order Source # 
PrintDot LayerList Source # 
PrintDot LayerID Source # 
PrintDot LayerRangeElem Source # 
PrintDot LayerListSep Source # 
PrintDot LayerSep Source # 
PrintDot Overlap Source # 
PrintDot Point Source # 
PrintDot LabelScheme Source # 
PrintDot RecordField Source # 
PrintDot Label Source # 
PrintDot Model Source # 
PrintDot ModeType Source # 
PrintDot GraphSize Source # 
PrintDot SVGFontNames Source # 
PrintDot DPoint Source # 
PrintDot DEConstraints Source # 
PrintDot DirType Source # 
PrintDot ClusterMode Source # 
PrintDot Rect Source # 
PrintDot ArrowSide Source # 
PrintDot ArrowFill Source # 
PrintDot ArrowModifier Source # 
PrintDot ArrowShape Source # 
PrintDot ArrowType Source # 
PrintDot Attribute Source # 
PrintDot GlobalAttributes Source # 
PrintDot GraphID Source # 
PrintDot a => PrintDot [a] Source # 

Methods

unqtDot :: [a] -> DotCode Source #

toDot :: [a] -> DotCode Source #

unqtListToDot :: [[a]] -> DotCode Source #

listToDot :: [[a]] -> DotCode Source #

PrintDot n => PrintDot (DotEdge n) Source # 
PrintDot n => PrintDot (DotNode n) Source # 
PrintDot n => PrintDot (DotSubGraph n) Source # 
PrintDot n => PrintDot (DotStatements n) Source # 
PrintDot n => PrintDot (DotGraph n) Source # 
PrintDot n => PrintDot (DotSubGraph n) Source # 
PrintDot n => PrintDot (DotStatement n) Source # 
PrintDot n => PrintDot (DotGraph n) Source # 
PrintDot n => PrintDot (DotGraph n) Source #

Uses the PrintDot instance for canonical DotGraphs.

unqtText :: Text -> DotCode Source #

For use with OverloadedStrings to avoid ambiguous type variable errors.

dotText :: Text -> DotCode Source #

For use with OverloadedStrings to avoid ambiguous type variable errors.

printIt :: PrintDot a => a -> Text Source #

Convert to DotCode; note that this has no indentation, as we can only have one of indentation and (possibly) infinite line lengths.

unqtEscaped :: [Char] -> Text -> DotCode Source #

Escape the specified chars as well as ".

printEscaped :: [Char] -> Text -> DotCode Source #

Escape the specified chars as well as " and then wrap the result in quotes.

commaDel :: (PrintDot a, PrintDot b) => a -> b -> DotCode Source #