tamarin-prover-utils-0.8.5.1: Utility library for the tamarin prover.

Portabilityportable
Stabilityunstable
MaintainerAndy Gill <andygill@ku.edu>
Safe HaskellSafe-Inferred

Text.Dot

Contents

Description

This module provides a simple interface for building .dot graph files, for input into the dot and graphviz tools. It includes a monadic interface for building graphs.

Synopsis

Dot

data Dot a Source

Instances

Monad Dot 
Functor Dot 
Applicative Dot 

Nodes

node :: [(String, String)] -> Dot NodeIdSource

node takes a list of attributes, generates a new node, and gives a NodeId. Multi-line labels are fixed such that they use non-breaking spaces and are terminated with a new-line.

data NodeId Source

Instances

Show NodeId 

userNodeId :: Int -> NodeIdSource

userNodeId allows a user to use their own (Int-based) node id's, without needing to remap them.

userNode :: NodeId -> [(String, String)] -> Dot ()Source

userNode takes a NodeId, and adds some attributes to that node.

Edges

edge :: NodeId -> NodeId -> [(String, String)] -> Dot ()Source

edge generates an edge between two NodeIds, with attributes.

Showing a graph

showDot :: Dot a -> StringSource

Other combinators

scope :: Dot a -> Dot aSource

scope groups a subgraph together; in dot these are the subgraphs inside { and }.

attribute :: (String, String) -> Dot ()Source

attribute gives a attribute to the current scope.

nodeAttributes :: [(String, String)] -> Dot ()Source

nodeAttributes sets attributes for all the following nodes in the scope.

edgeAttributes :: [(String, String)] -> Dot ()Source

edgeAttributes sets attributes for all the following edges in the scope.

graphAttributes :: [(String, String)] -> Dot ()Source

graphAttributes sets attributes for current graph.

share :: [(String, String)] -> [NodeId] -> Dot ()Source

share is when a set of nodes share specific attributes. Usually used for layout tweaking.

same :: [NodeId] -> Dot ()Source

same provides a combinator for a common pattern; a set of NodeIds with the same rank.

cluster :: Dot a -> Dot (NodeId, a)Source

cluster builds an explicit, internally named subgraph (called cluster).

Record specification

data Record a Source

Specifies the construction of a record; i.e., mentions all fields possibly together with ports and their horizontal and vertical nesting. (see: record shapes in the DOT documentation.)

Instances

Eq a => Eq (Record a) 
Ord a => Ord (Record a) 
Show a => Show (Record a) 

field :: String -> Record aSource

A simple field of a record.

portField :: a -> String -> Record aSource

A field together with a port which can be used to create direct edges to this field. Note that you can use any type to identify the ports. When creating a record node you will get back an association list between your record identifiers and their concrete node ids.

hcat :: [Record a] -> Record aSource

Concatenate records horizontally.

hcat' :: [String] -> Record aSource

Concatenate a list strings interpreted as simple fields horizontally.

vcat :: [Record a] -> Record aSource

Concatenate records vertically.

vcat' :: [String] -> Record aSource

Concatenate a list strings interpreted as simple fields vertically.

Record node construction

record :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)])Source

Create a record node with the given attributes. It returns the node-id of the created node together with an association list mapping the port idenfiers given in the record to their corresponding node-ids. This list is ordered according to a left-to-rigth traversal of the record description.

record' :: Record a -> [(String, String)] -> Dot (NodeId, [NodeId])Source

A variant of record ignoring the port identifiers.

record_ :: Record a -> [(String, String)] -> Dot NodeIdSource

A variant of record ignoring the port to node-id association list.

mrecord :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)])Source

Like record, but creates record nodes with rounded corners; i.e. uses the "Mrecord" shape instead of the "record" shape.

mrecord' :: Record a -> [(String, String)] -> Dot (NodeId, [NodeId])Source

A variant of mrecord ignoring the port identifiers.

mrecord_ :: Record a -> [(String, String)] -> Dot NodeIdSource

A variant of mrecord ignoring the port to node-id association list.