graphviz-2999.20.1.0: 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

displayB :: SimpleDoc -> Builder #

displayTStrict :: SimpleDoc -> Text #

renderOneLine :: Doc -> SimpleDoc #

(<$$>) :: Applicative m => m Doc -> m Doc -> m Doc #

(<++>) :: Applicative m => m Doc -> m Doc -> m Doc #

(<+>) :: Applicative m => m Doc -> m Doc -> m Doc #

(<//>) :: Applicative m => m Doc -> m Doc -> m Doc #

(</>) :: Applicative m => m Doc -> m Doc -> m Doc #

align :: Functor m => m Doc -> m Doc #

angles :: Functor m => m Doc -> m Doc #

beside :: Applicative m => m Doc -> m Doc -> m Doc #

braces :: Functor m => m Doc -> m Doc #

brackets :: Functor m => m Doc -> m Doc #

cat :: Functor m => m [Doc] -> m Doc #

char :: Applicative m => Char -> m Doc #

column :: Functor m => m (Int -> Doc) -> m Doc #

dot :: Applicative m => m Doc #

double :: Applicative m => Double -> m Doc #

dquotes :: Functor m => m Doc -> m Doc #

enclose :: Applicative m => m Doc -> m Doc -> m Doc -> m Doc #

encloseSep :: Applicative m => m Doc -> m Doc -> m Doc -> m [Doc] -> m Doc #

fill :: Functor m => Int -> m Doc -> m Doc #

fillBreak :: Functor m => Int -> m Doc -> m Doc #

fillCat :: Functor m => m [Doc] -> m Doc #

fillSep :: Functor m => m [Doc] -> m Doc #

float :: Applicative m => Float -> m Doc #

group :: Functor m => m Doc -> m Doc #

hang :: Functor m => Int -> m Doc -> m Doc #

hcat :: Functor m => m [Doc] -> m Doc #

hsep :: Functor m => m [Doc] -> m Doc #

indent :: Functor m => Int -> m Doc -> m Doc #

int :: Applicative m => Int -> m Doc #

integer :: Applicative m => Integer -> m Doc #

line :: Applicative m => m Doc #

list :: Functor m => m [Doc] -> m Doc #

nest :: Functor m => Int -> m Doc -> m Doc #

nesting :: Functor m => m (Int -> Doc) -> m Doc #

parens :: Functor m => m Doc -> m Doc #

prettyM :: (Pretty a, Applicative m) => a -> m Doc #

punctuate :: Applicative m => m Doc -> m [Doc] -> m [Doc] #

rational :: Applicative m => Rational -> m Doc #

semi :: Applicative m => m Doc #

semiBraces :: Functor m => m [Doc] -> m Doc #

sep :: Functor m => m [Doc] -> m Doc #

squotes :: Functor m => m Doc -> m Doc #

stringStrict :: Monad m => Text -> m Doc #

text :: Applicative m => Text -> m Doc #

textStrict :: Monad m => Text -> m Doc #

tupled :: Functor m => m [Doc] -> m Doc #

vcat :: Functor m => m [Doc] -> m Doc #

vsep :: Functor m => m [Doc] -> m Doc #

data Doc #

Instances

Instances details
Show Doc 
Instance details

Defined in Text.PrettyPrint.Leijen.Text

Methods

showsPrec :: Int -> Doc -> ShowS

show :: Doc -> String

showList :: [Doc] -> ShowS

Show DotCode 
Instance details

Defined in Data.GraphViz.Printing

Methods

showsPrec :: Int -> DotCode -> ShowS

show :: DotCode -> String

showList :: [DotCode] -> ShowS

IsString Doc 
Instance details

Defined in Text.PrettyPrint.Leijen.Text

Methods

fromString :: String -> Doc

IsString DotCode 
Instance details

Defined in Data.GraphViz.Printing

Methods

fromString :: String -> DotCode

Semigroup Doc 
Instance details

Defined in Text.PrettyPrint.Leijen.Text

Methods

(<>) :: Doc -> Doc -> Doc

sconcat :: NonEmpty Doc -> Doc

stimes :: Integral b => b -> Doc -> Doc

Semigroup DotCode 
Instance details

Defined in Data.GraphViz.Printing

Methods

(<>) :: DotCode -> DotCode -> DotCode

sconcat :: NonEmpty DotCode -> DotCode

stimes :: Integral b => b -> DotCode -> DotCode

Monoid Doc 
Instance details

Defined in Text.PrettyPrint.Leijen.Text

Methods

mempty :: Doc

mappend :: Doc -> Doc -> Doc

mconcat :: [Doc] -> Doc

Monoid DotCode 
Instance details

Defined in Data.GraphViz.Printing

Pretty Doc 
Instance details

Defined in Text.PrettyPrint.Leijen.Text

Methods

pretty :: Doc -> Doc

prettyList :: [Doc] -> Doc

data DotCodeM a Source #

A type alias to indicate what is being produced.

Instances

Instances details
Monad DotCodeM Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

(>>=) :: DotCodeM a -> (a -> DotCodeM b) -> DotCodeM b

(>>) :: DotCodeM a -> DotCodeM b -> DotCodeM b

return :: a -> DotCodeM a

Functor DotCodeM Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

fmap :: (a -> b) -> DotCodeM a -> DotCodeM b

(<$) :: a -> DotCodeM b -> DotCodeM a #

Show DotCode Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

showsPrec :: Int -> DotCode -> ShowS

show :: DotCode -> String

showList :: [DotCode] -> ShowS

IsString DotCode Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

fromString :: String -> DotCode

Applicative DotCodeM Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

pure :: a -> DotCodeM a #

(<*>) :: DotCodeM (a -> b) -> DotCodeM a -> DotCodeM b #

liftA2 :: (a -> b -> c) -> DotCodeM a -> DotCodeM b -> DotCodeM c #

(*>) :: DotCodeM a -> DotCodeM b -> DotCodeM b #

(<*) :: DotCodeM a -> DotCodeM b -> DotCodeM a #

Semigroup DotCode Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

(<>) :: DotCode -> DotCode -> DotCode

sconcat :: NonEmpty DotCode -> DotCode

stimes :: Integral b => b -> DotCode -> DotCode

Monoid DotCode Source # 
Instance details

Defined in Data.GraphViz.Printing

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

Instances details
PrintDot Bool Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Bool -> DotCode Source #

toDot :: Bool -> DotCode Source #

unqtListToDot :: [Bool] -> DotCode Source #

listToDot :: [Bool] -> DotCode Source #

PrintDot Char Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Char -> DotCode Source #

toDot :: Char -> DotCode Source #

unqtListToDot :: [Char] -> DotCode Source #

listToDot :: [Char] -> DotCode Source #

PrintDot Double Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Double -> DotCode Source #

toDot :: Double -> DotCode Source #

unqtListToDot :: [Double] -> DotCode Source #

listToDot :: [Double] -> DotCode Source #

PrintDot Int Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Int -> DotCode Source #

toDot :: Int -> DotCode Source #

unqtListToDot :: [Int] -> DotCode Source #

listToDot :: [Int] -> DotCode Source #

PrintDot Integer Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Integer -> DotCode Source #

toDot :: Integer -> DotCode Source #

unqtListToDot :: [Integer] -> DotCode Source #

listToDot :: [Integer] -> DotCode Source #

PrintDot Word8 Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Word8 -> DotCode Source #

toDot :: Word8 -> DotCode Source #

unqtListToDot :: [Word8] -> DotCode Source #

listToDot :: [Word8] -> DotCode Source #

PrintDot Word16 Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Word16 -> DotCode Source #

toDot :: Word16 -> DotCode Source #

unqtListToDot :: [Word16] -> DotCode Source #

listToDot :: [Word16] -> DotCode Source #

PrintDot BrewerName Source # 
Instance details

Defined in Data.GraphViz.Printing

PrintDot BrewerScheme Source # 
Instance details

Defined in Data.GraphViz.Printing

PrintDot ColorScheme Source # 
Instance details

Defined in Data.GraphViz.Printing

PrintDot Text Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Text -> DotCode Source #

toDot :: Text -> DotCode Source #

unqtListToDot :: [Text] -> DotCode Source #

listToDot :: [Text] -> DotCode Source #

PrintDot Text Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Text -> DotCode Source #

toDot :: Text -> DotCode Source #

unqtListToDot :: [Text] -> DotCode Source #

listToDot :: [Text] -> DotCode Source #

PrintDot Version Source #

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

Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: Version -> DotCode Source #

toDot :: Version -> DotCode Source #

unqtListToDot :: [Version] -> DotCode Source #

listToDot :: [Version] -> DotCode Source #

PrintDot GraphvizCommand Source # 
Instance details

Defined in Data.GraphViz.Commands.Available

PrintDot CompassPoint Source # 
Instance details

Defined in Data.GraphViz.Attributes.Internal

PrintDot PortPos Source # 
Instance details

Defined in Data.GraphViz.Attributes.Internal

PrintDot PortName Source # 
Instance details

Defined in Data.GraphViz.Attributes.Internal

PrintDot X11Color Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors.X11

PrintDot SVGColor Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors.SVG

PrintDot WeightedColor Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors

PrintDot Color Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors

PrintDot Style Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Side Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Scale Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot CellFormat Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot VAlign Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Align Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Attribute Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Img Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Cell Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Row Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Table Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Format Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot TextItem Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot Label Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

PrintDot NodeSize Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Normalized Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Number Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Ratios Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Justification Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot ScaleType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Paths Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot VerticalPlacement Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot FocusType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot ViewPort Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot StyleName Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot StyleItem Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot STStyle Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot StartType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot SmoothType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Shape Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot RankDir Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot RankType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Root Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot QuadType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Spline Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot PageDir Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot EdgeType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Pos Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot PackMode Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Pack Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot OutputMode Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Order Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot LayerList Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot LayerID Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot LayerRangeElem Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot LayerListSep Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot LayerSep Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Overlap Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Point Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot LabelScheme Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot RecordField Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Label Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Model Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot ModeType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot GraphSize Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot SVGFontNames Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot DPoint Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot DEConstraints Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot DirType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot ClusterMode Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot Rect Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

PrintDot ArrowSide Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

PrintDot ArrowFill Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

PrintDot ArrowModifier Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

PrintDot ArrowShape Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

PrintDot ArrowType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

PrintDot Attribute Source # 
Instance details

Defined in Data.GraphViz.Attributes.Complete

PrintDot GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

PrintDot GraphID Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

PrintDot a => PrintDot [a] Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

unqtDot :: [a] -> DotCode Source #

toDot :: [a] -> DotCode Source #

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

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

PrintDot n => PrintDot (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

PrintDot n => PrintDot (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

PrintDot n => PrintDot (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

PrintDot n => PrintDot (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

PrintDot n => PrintDot (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

PrintDot n => PrintDot (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Generalised

PrintDot n => PrintDot (DotStatement n) Source # 
Instance details

Defined in Data.GraphViz.Types.Generalised

PrintDot n => PrintDot (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Generalised

PrintDot n => PrintDot (DotGraph n) Source #

Uses the PrintDot instance for canonical DotGraphs.

Instance details

Defined in Data.GraphViz.Types.Graph

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 #

printField :: PrintDot a => Text -> a -> DotCode Source #