graphviz-2999.16.0.0: Bindings to Graphviz for graph visualisation.

MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone

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

type DotCode = State GraphvizState DocSource

A type alias to indicate what is being produced.

renderDot :: DotCode -> TextSource

Correctly render Graphviz output.

class PrintDot a whereSource

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

Methods

unqtDot :: a -> DotCodeSource

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

toDot :: a -> DotCodeSource

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] -> DotCodeSource

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] -> DotCodeSource

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 
PrintDot Char 
PrintDot Double 
PrintDot Int 
PrintDot Integer 
PrintDot Word8 
PrintDot Word16 
PrintDot Text 
PrintDot BrewerName 
PrintDot BrewerScheme 
PrintDot ColorScheme 
PrintDot X11Color 
PrintDot CompassPoint 
PrintDot PortPos 
PrintDot PortName 
PrintDot SVGColor 
PrintDot WeightedColor 
PrintDot Color 
PrintDot Scale 
PrintDot VAlign 
PrintDot Align 
PrintDot Attribute 
PrintDot Img 
PrintDot Cell 
PrintDot Row 
PrintDot Table 
PrintDot Format 
PrintDot TextItem 
PrintDot Label 
PrintDot Ratios 
PrintDot Justification 
PrintDot ScaleType 
PrintDot Paths 
PrintDot VerticalPlacement 
PrintDot FocusType 
PrintDot ViewPort 
PrintDot StyleName 
PrintDot StyleItem 
PrintDot STStyle 
PrintDot StartType 
PrintDot SmoothType 
PrintDot Shape 
PrintDot RankDir 
PrintDot RankType 
PrintDot Root 
PrintDot QuadType 
PrintDot Spline 
PrintDot PageDir 
PrintDot EdgeType 
PrintDot Pos 
PrintDot PackMode 
PrintDot Pack 
PrintDot OutputMode 
PrintDot Order 
PrintDot LayerList 
PrintDot LayerID 
PrintDot LayerRangeElem 
PrintDot LayerListSep 
PrintDot LayerSep 
PrintDot Overlap 
PrintDot Point 
PrintDot LabelScheme 
PrintDot RecordField 
PrintDot Label 
PrintDot Model 
PrintDot ModeType 
PrintDot GraphSize 
PrintDot SVGFontNames 
PrintDot DPoint 
PrintDot DEConstraints 
PrintDot DirType 
PrintDot ClusterMode 
PrintDot Rect 
PrintDot AspectType 
PrintDot ArrowSide 
PrintDot ArrowFill 
PrintDot ArrowModifier 
PrintDot ArrowShape 
PrintDot ArrowType 
PrintDot GraphvizCommand 
PrintDot Attribute 
PrintDot GlobalAttributes 
PrintDot GraphID 
PrintDot a => PrintDot [a] 
PrintDot n => PrintDot (DotEdge n) 
PrintDot n => PrintDot (DotNode n) 
PrintDot n => PrintDot (DotSubGraph n) 
PrintDot n => PrintDot (DotStatements n) 
PrintDot n => PrintDot (DotGraph n) 
PrintDot n => PrintDot (DotSubGraph n) 
PrintDot n => PrintDot (DotStatement n) 
PrintDot n => PrintDot (DotGraph n) 
(Ord n, PrintDot n) => PrintDot (DotGraph n)

Uses the PrintDot instance for canonical DotGraphs.

unqtText :: Text -> DotCodeSource

For use with OverloadedStrings to avoid ambiguous type variable errors.

dotText :: Text -> DotCodeSource

For use with OverloadedStrings to avoid ambiguous type variable errors.

printIt :: PrintDot a => a -> TextSource

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 -> DotCodeSource

Escape the specified chars as well as ".

printEscaped :: [Char] -> Text -> DotCodeSource

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

commaDel :: (PrintDot a, PrintDot b) => a -> b -> DotCodeSource

printField :: PrintDot a => Text -> a -> DotCodeSource