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

Copyright | Andy Gill Simon Meier (extension to record syntax)
License | BSD3
Maintainer | Andy Gill <andygill@ku.edu>
Stability | unstable
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Text.Dot

Contents

- Dot
- Nodes
- Edges
- Showing a graph
- Other combinators
- Record specification
- Record node construction

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

- data Dot a
- node :: [(String, String)] -> Dot NodeId
- data NodeId
- userNodeId :: Int -> NodeId
- userNode :: NodeId -> [(String, String)] -> Dot ()
- edge :: NodeId -> NodeId -> [(String, String)] -> Dot ()
- showDot :: Dot a -> String
- scope :: Dot a -> Dot a
- attribute :: (String, String) -> Dot ()
- nodeAttributes :: [(String, String)] -> Dot ()
- edgeAttributes :: [(String, String)] -> Dot ()
- graphAttributes :: [(String, String)] -> Dot ()
- share :: [(String, String)] -> [NodeId] -> Dot ()
- same :: [NodeId] -> Dot ()
- cluster :: Dot a -> Dot (NodeId, a)
- data Record a
- field :: String -> Record a
- portField :: a -> String -> Record a
- hcat :: [Record a] -> Record a
- hcat' :: [String] -> Record a
- vcat :: [Record a] -> Record a
- vcat' :: [String] -> Record a
- record :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)])
- record' :: Record a -> [(String, String)] -> Dot (NodeId, [NodeId])
- record_ :: Record a -> [(String, String)] -> Dot NodeId
- mrecord :: Record a -> [(String, String)] -> Dot (NodeId, [(a, NodeId)])
- mrecord' :: Record a -> [(String, String)] -> Dot (NodeId, [NodeId])
- mrecord_ :: Record a -> [(String, String)] -> Dot NodeId

# Dot

data Dot a #

Instances

Monad Dot # |
Methods (>>=) :: Dot a -> (a -> Dot b) -> Dot b # (>>) :: Dot a -> Dot b -> Dot b # return :: a -> Dot a # fail :: String -> Dot a #
Functor Dot # |
Methods fmap :: (a -> b) -> Dot a -> Dot b # (<$) :: a -> Dot b -> Dot a #
Applicative Dot # |
Methods pure :: a -> Dot a # (<*>) :: Dot (a -> b) -> Dot a -> Dot b # (*>) :: Dot a -> Dot b -> Dot b # (<*) :: Dot a -> Dot b -> Dot a #

# Nodes

node :: [(String, String)] -> Dot NodeId #

`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 #

Instances

Show NodeId # |
Methods showsPrec :: Int -> NodeId -> ShowS # show :: NodeId -> String # showList :: [NodeId] -> ShowS #

userNodeId :: Int -> NodeId #

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

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

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

# Edges

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

`edge` generates an edge between two `NodeId`s, with attributes.

# Showing a graph

showDot :: Dot a -> String #

# Other combinators

scope :: Dot a -> Dot a #

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

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

`attribute` gives a attribute to the current scope.

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

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

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

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

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

`graphAttributes` sets attributes for current graph.

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

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

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

`same` provides a combinator for a common pattern; a set of `NodeId`s with the same rank.

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

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

# Record specification

data Record a #

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) # |
Methods (==) :: Record a -> Record a -> Bool # (/=) :: Record a -> Record a -> Bool #
Ord a => Ord (Record a) # |
Methods compare :: Record a -> Record a -> Ordering # (<) :: Record a -> Record a -> Bool # (<=) :: Record a -> Record a -> Bool # (>) :: Record a -> Record a -> Bool # (>=) :: Record a -> Record a -> Bool # max :: Record a -> Record a -> Record a # min :: Record a -> Record a -> Record a #
Show a => Show (Record a) # |
Methods showsPrec :: Int -> Record a -> ShowS # show :: Record a -> String # showList :: [Record a] -> ShowS #

field :: String -> Record a #

A simple field of a record.

portField :: a -> String -> Record a #

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 a #

Concatenate records horizontally.

hcat' :: [String] -> Record a #

Concatenate a list strings interpreted as simple fields horizontally.

vcat :: [Record a] -> Record a #

Concatenate records vertically.

vcat' :: [String] -> Record a #

Concatenate a list strings interpreted as simple fields vertically.

# Record node construction

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

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]) #

A variant of "record" ignoring the port identifiers.

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

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

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

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]) #

A variant of "mrecord" ignoring the port identifiers.

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

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