module Text.Dot.Types.Internal (
module Text.Dot.Types.Internal
, Identity(..)
, Monoid(..)
) where
import Data.Text (Text)
import Control.Monad.Identity (Identity (..))
type GraphName = Text
data GraphType = UndirectedGraph
| DirectedGraph
deriving (Show, Eq)
type AttributeName = Text
type AttributeValue = Text
type Attribute = (AttributeName, AttributeValue)
data NodeId = UserId Text
| Nameless Int
deriving (Show, Eq)
data DecType = DecGraph
| DecNode
| DecEdge
deriving (Show, Eq)
data DotGraph = Graph GraphType GraphName Dot
deriving (Show, Eq)
data RankdirType = LR
| RL
| TB
| BT
deriving (Show, Eq)
data Dot = Node NodeId [Attribute]
| Edge NodeId NodeId [Attribute]
| Declaration DecType [Attribute]
| Ranksame Dot
| Subgraph Text Dot
| RawDot Text
| Label Text
| Rankdir RankdirType
| DotSeq Dot Dot
| DotEmpty
deriving (Show, Eq)
instance Monoid Dot where
mempty = DotEmpty
mappend DotEmpty d = d
mappend d DotEmpty = d
mappend d (DotSeq d1 d2) = DotSeq (mappend d d1) d2
mappend d1 d2 = DotSeq d1 d2