HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulegraphviz-2999.20.2.0Haskell2010

Data.GraphViz.Types

Four different representations of Dot graphs are available, all of which are based loosely upon the specifications at: http://graphviz.org/doc/info/lang.html. The DotRepr class provides a common interface for them (the PrintDotRepr, ParseDotRepr and PPDotRepr classes are used until class aliases are implemented).

Every representation takes in a type parameter: this indicates the node type (e.g. DotGraph Int is a Dot graph with integer nodes). Sum types are allowed, though care must be taken when specifying their ParseDot instances if there is the possibility of overlapping definitions. The GraphID type is an existing sum type that allows textual and numeric values.

If you require using more than one Dot representation, you will most likely need to import at least one of them qualified, as they typically all use the same names.

As a comparison, all four representations provide how you would define the following Dot graph (or at least one isomorphic to it) (the original of which can be found at http://graphviz.org/content/cluster). Note that in all the examples, they are not necessarily done the best way (variables rather than repeated constants, etc.); they are just there to provide a comparison on the structure of each representation.

digraph G {

  subgraph cluster_0 {
    style=filled;
    color=lightgrey;
    node [style=filled,color=white];
    a0 -> a1 -> a2 -> a3;
    label = "process #1";
  }

  subgraph cluster_1 {
    node [style=filled];
    b0 -> b1 -> b2 -> b3;
    label = "process #2";
    color=blue
  }
  start -> a0;
  start -> b0;
  a1 -> b3;
  b2 -> a3;
  a3 -> a0;
  a3 -> end;
  b3 -> end;

  start [shape=Mdiamond];
  end [shape=Msquare];
}

Each representation is suited for different things:

Data.GraphViz.Types.Canonical

is ideal for converting other graph-like data structures into Dot graphs (the

Data.GraphViz

module provides some functions for this). It is a structured representation of Dot code.

Data.GraphViz.Types.Generalised

matches the actual structure of Dot code. As such, it is suited for parsing in existing Dot code.

Data.GraphViz.Types.Graph

provides graph operations for manipulating Dot graphs; this is suited when you want to edit existing Dot code. It uses generalised Dot graphs for parsing and canonical Dot graphs for printing.

Data.GraphViz.Types.Monadic

is a much easier representation to use when defining relatively static Dot graphs in Haskell code, and looks vaguely like actual Dot code if you squint a bit.

Please also read the limitations section at the end for advice on how to properly use these Dot representations.

  • 8 types
  • 7 classes
  • 9 values
classclass Ord n => DotRepr (dg :: Type -> Type) n where
#

This class is used to provide a common interface to different ways of representing a graph in Dot form.

You will most probably not need to create your own instances of this class.

The type variable represents the current node type of the Dot graph, and the Ord restriction is there because in practice most implementations of some of these methods require it.

Methods

Instances3DotRepr
classclass PrintDot a where
#

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

Methods

  • unqtDot :: a -> DotCode

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

  • toDot :: a -> DotCode

    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

    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

    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).

Instances102PrintDot, …
  • PrintDot IntegerDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot VersionDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing

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

  • PrintDot Word16Defined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot Word32Defined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot Word64Defined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot Word8Defined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot BoolDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot CharDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot DoubleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot IntDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot ArrowFillDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • PrintDot ArrowModifierDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • PrintDot ArrowShapeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • PrintDot ArrowSideDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • PrintDot ArrowTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • PrintDot BrewerNameDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot BrewerSchemeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot ColorSchemeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot ColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors
  • PrintDot WeightedColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors
  • PrintDot SVGColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors.SVG
  • PrintDot X11ColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors.X11
  • PrintDot AttributeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Complete
  • PrintDot AlignDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot AttributeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot CellDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot CellFormatDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot FormatDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot ImgDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot LabelDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot RowDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot ScaleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot SideDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot StyleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot TableDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot TextItemDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot VAlignDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • PrintDot CompassPointDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Internal
  • PrintDot PortNameDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Internal
  • PrintDot PortPosDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Internal
  • PrintDot ClusterModeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot DEConstraintsDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot DPointDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot DirTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot EdgeTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot FocusTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot GraphSizeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot JustificationDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot LabelDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot LabelSchemeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot LayerIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot LayerListDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot LayerListSepDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot LayerRangeElemDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot LayerSepDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot ModeTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot ModelDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot NodeSizeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot NormalizedDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot OrderDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot OutputModeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot OverlapDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot PackDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot PackModeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot PageDirDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot PathsDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot PointDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot PosDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot QuadTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot RankDirDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot RankTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot RatiosDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot RecordFieldDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot RectDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot RootDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot STStyleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot SVGFontNamesDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot ScaleTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot ShapeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot SmoothTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot SplineDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot StartTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot StyleItemDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot StyleNameDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot VerticalPlacementDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot ViewPortDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot GraphvizCommandDefined in graphviz-2999.20.2.0 · Data.GraphViz.Commands.Available
  • PrintDot GlobalAttributesDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot TextDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot TextDefined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot a => PrintDot [a]Defined in graphviz-2999.20.2.0 · Data.GraphViz.Printing
  • PrintDot n => PrintDot (DotGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Canonical
  • PrintDot n => PrintDot (DotStatements n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Canonical
  • PrintDot n => PrintDot (DotSubGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Canonical
  • PrintDot n => PrintDot (DotGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Generalised
  • PrintDot n => PrintDot (DotStatement n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Generalised
  • PrintDot n => PrintDot (DotSubGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Generalised
  • PrintDot n => PrintDot (DotGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Graph

    Uses the PrintDot instance for canonical DotGraphs.

  • PrintDot n => PrintDot (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot n => PrintDot (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
classclass ParseDot a where
#
Instances100ParseDot, …
  • ParseDot IntegerDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot VersionDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing

    Ignores versionTags and assumes 'not . null . versionBranch' (usually you want 'length . versionBranch == 2') and that all such values are non-negative.

  • ParseDot Word16Defined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot Word8Defined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot BoolDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot CharDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot DoubleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot IntDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot ArrowFillDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • ParseDot ArrowModifierDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • ParseDot ArrowShapeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • ParseDot ArrowSideDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • ParseDot ArrowTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Arrows
  • ParseDot BrewerNameDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot BrewerSchemeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot ColorSchemeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot ColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors
  • ParseDot WeightedColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors
  • ParseDot SVGColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors.SVG
  • ParseDot X11ColorDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Colors.X11
  • ParseDot AttributeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Complete
  • ParseDot AlignDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot AttributeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot CellDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot CellFormatDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot FormatDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot ImgDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot LabelDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot RowDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot ScaleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot SideDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot StyleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot TableDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot TextItemDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot VAlignDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.HTML
  • ParseDot CompassPointDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Internal
  • ParseDot PortNameDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Internal
  • ParseDot PortPosDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Internal
  • ParseDot ClusterModeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot DEConstraintsDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot DPointDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot DirTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot EdgeTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot FocusTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot GraphSizeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot JustificationDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot LabelDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot LabelSchemeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot LayerIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot LayerListDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot LayerListSepDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot LayerRangeElemDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot LayerSepDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot ModeTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot ModelDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot NodeSizeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot NormalizedDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot OrderDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot OutputModeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot OverlapDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values

    Note that overlap=false defaults to PrismOverlap Nothing, but if the Prism library isn't available then it is equivalent to VoronoiOverlap.

  • ParseDot PackDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot PackModeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot PageDirDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot PathsDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot PointDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot PosDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot QuadTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot RankDirDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot RankTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot RatiosDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot RecordFieldDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot RectDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot RootDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot STStyleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot SVGFontNamesDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot ScaleTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot ShapeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot SmoothTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot SplineDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot StartTypeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot StyleItemDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot StyleNameDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot VerticalPlacementDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot ViewPortDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot GraphvizCommandDefined in graphviz-2999.20.2.0 · Data.GraphViz.Commands.Available
  • ParseDot GlobalAttributesDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot TextDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot TextDefined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot a => ParseDot [a]Defined in graphviz-2999.20.2.0 · Data.GraphViz.Parsing
  • ParseDot n => ParseDot (DotGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Canonical
  • ParseDot n => ParseDot (DotStatements n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Canonical
  • ParseDot n => ParseDot (DotSubGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Canonical
  • ParseDot n => ParseDot (DotGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Generalised
  • ParseDot n => ParseDot (DotStatement n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Generalised
  • ParseDot n => ParseDot (DotSubGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Generalised
  • ParseDot n => ParseDot (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot n => ParseDot (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • (Ord n, ParseDot n) => ParseDot (DotGraph n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Graph

    Uses the ParseDot instance for generalised DotGraphs.

classclass (DotRepr dg n, PrintDot (dg n)) => PrintDotRepr (dg :: Type -> Type) n
#

This class exists just to make type signatures nicer; all instances of DotRepr should also be an instance of PrintDotRepr.

Instances3PrintDotRepr
classclass (DotRepr dg n, ParseDot (dg n)) => ParseDotRepr (dg :: Type -> Type) n
#

This class exists just to make type signatures nicer; all instances of DotRepr should also be an instance of ParseDotRepr.

Instances3ParseDotRepr
classclass (PrintDotRepr dg n, ParseDotRepr dg n) => PPDotRepr (dg :: Type -> Type) n
#

This class exists just to make type signatures nicer; all instances of DotRepr should also be an instance of PPDotRepr.

Instances3PPDotRepr

Common sub-types

7 declarations
datadata GraphID
#

A polymorphic type that covers all possible ID values allowed by Dot syntax. Note that whilst the ParseDot and PrintDot instances for String will properly take care of the special cases for numbers, they are treated differently here.

Constructors

Instances6Eq, Ord, Read, Show, ParseDot, PrintDot
  • Eq GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Ord GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Read GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Show GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot GraphIDDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
datadata Number
#

A numeric type with an explicit separation between integers and floating-point values.

Constructors

Instances6Eq, Ord, Read, Show, ParseDot, PrintDot
  • Eq NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • Ord NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • Read NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • Show NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • ParseDot NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
  • PrintDot NumberDefined in graphviz-2999.20.2.0 · Data.GraphViz.Attributes.Values
classclass ToGraphID a where
#

A convenience class to make it easier to convert data types to GraphID values, e.g. for cluster identifiers.

In most cases, conversion would be via the Text or String instances (e.g. using show).

Methods

Instances6ToGraphID
  • ToGraphID IntegerDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types

    This instance loses precision by going via Int.

  • ToGraphID StringDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types
  • ToGraphID CharDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types
  • ToGraphID DoubleDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types
  • ToGraphID IntDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types
  • ToGraphID TextDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types
datadata GlobalAttributes
#

Represents a list of top-level list of Attributes for the entire graph/sub-graph. Note that GraphAttrs also applies to DotSubGraphs.

Note that Dot allows a single Attribute to be listed on a line; if this is the case then when parsing, the type of Attribute it is determined and that type of GlobalAttribute is created.

Instances6Eq, Ord, Read, Show, ParseDot, PrintDot
datadata DotNode n
#

A node in DotGraph.

Instances7Functor, Eq, Ord, Read, Show, ParseDot, …
  • Functor DotNodeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Eq n => Eq (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Ord n => Ord (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Read n => Read (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Show n => Show (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot n => ParseDot (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot n => PrintDot (DotNode n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
datadata DotEdge n
#

An edge in DotGraph.

Instances7Functor, Eq, Ord, Read, Show, ParseDot, …
  • Functor DotEdgeDefined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Eq n => Eq (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Ord n => Ord (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Read n => Read (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • Show n => Show (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • ParseDot n => ParseDot (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common
  • PrintDot n => PrintDot (DotEdge n)Defined in graphviz-2999.20.2.0 · Data.GraphViz.Types.Internal.Common

Helper types for looking up information within a DotRepr.

6 declarations
typetype Path = Seq (Maybe GraphID)
#

The path of clusters that must be traversed to reach this spot.

Obtaining the DotNodes and DotEdges.

2 declarations

Printing and parsing a DotRepr.

3 declarations
valueparseDotGraph :: ParseDotRepr dg n => Text -> dg n
#

Parse a limited subset of the Dot language to form an instance of DotRepr. Each instance may have its own limitations on what may or may not be parseable Dot code.

Also removes any comments, etc. before parsing.

valueparseDotGraphLiberally :: ParseDotRepr dg n => Text -> dg n
#

As with parseDotGraph, but if an Attribute cannot be parsed strictly according to the known rules, let it fall back to being parsed as an UnknownAttribute. This is especially useful for when using a version of Graphviz that is either newer (especially for the XDot attributes) or older (when some attributes have changed) but you'd still prefer it to parse rather than throwing an error.

Limitations and documentation

0 declarations

Printing of Dot code is done as strictly as possible, whilst parsing is as permissive as possible. For example, if the types allow it then "2" will be parsed as an Int value. Note that quoting and escaping of textual values is done automagically.

A summary of known limitations/differences:

  • When creating GraphID values for graphs and sub-graphs, you should ensure that none of them have the same printed value as one of the node identifiers values to avoid any possible problems.

  • If you want any GlobalAttributes in a sub-graph and want them to only apply to that sub-graph, then you must ensure it does indeed have a valid GraphID.

  • All sub-graphs which represent clusters should have unique identifiers (well, only if you want them to be generated sensibly).

  • If eventually outputting to a format such as SVG, then you should make sure to specify an identifier for the overall graph, as that is used as the title of the resulting image.

  • Whilst the graphs, etc. are polymorphic in their node type, you should ensure that you use a relatively simple node type (that is, it only covers a single line, etc.).

  • Also, whilst Graphviz allows you to mix the types used for nodes, this library requires/assumes that they are all the same type (but you can use a sum-type).

  • DotEdge defines an edge (a, b) (with an edge going from a to b); in Dot parlance the edge has a head at a and a tail at b. Care must be taken when using the related Head* and Tail* Attributes. See the differences section in Data.GraphViz.Attributes for more information.

  • It is common to see multiple edges defined on the one line in Dot (e.g. n1 -> n2 -> n3 means to create a directed edge from n1 to n2 and from n2 to n3). These types of edge definitions are parseable; however, they are converted to singleton edges.

  • It is not yet possible to create or parse edges with subgraphs/clusters as one of the end points.

  • The parser will strip out comments and pre-processor lines, join together multiline statements and concatenate split strings together. However, pre-processing within HTML-like labels is currently not supported.

  • Graphviz allows a node to be "defined" twice (e.g. the actual node definition, and then in a subgraph with extra global attributes applied to it). This actually represents the same node, but when parsing they will be considered as separate DotNodes (such that graphNodes will return both "definitions"). canonicalise from Data.GraphViz.Algorithms can be used to fix this.

See Data.GraphViz.Attributes.Complete for more limitations.