graphviz 2008.7.10 → 2008.7.11
raw patch · 4 files changed
+69/−24 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.GraphViz.Attributes: BgColour :: ColourType -> Attribute
- Data.GraphViz.Attributes: Colour :: ColourType -> Attribute
- Data.GraphViz.Attributes: FillColour :: ColourType -> Attribute
- Data.GraphViz.Attributes: FontColour :: ColourType -> Attribute
- Data.GraphViz.Attributes: LabelFontColour :: ColourType -> Attribute
- Data.GraphViz.Attributes: PenColour :: ColourType -> Attribute
- Data.GraphViz.Attributes: data ColourType
- Data.GraphViz.Attributes: instance Show ColourType
- Data.GraphViz.Attributes: readColourType :: Parser Char ColourType
+ Data.GraphViz.Attributes: BgColor :: ColorType -> Attribute
+ Data.GraphViz.Attributes: Color :: ColorType -> Attribute
+ Data.GraphViz.Attributes: FillColor :: ColorType -> Attribute
+ Data.GraphViz.Attributes: FontColor :: ColorType -> Attribute
+ Data.GraphViz.Attributes: LabelFontColor :: ColorType -> Attribute
+ Data.GraphViz.Attributes: PenColor :: ColorType -> Attribute
+ Data.GraphViz.Attributes: Unknown :: String -> String -> Attribute
+ Data.GraphViz.Attributes: data ColorType
+ Data.GraphViz.Attributes: instance Eq ArrowType
+ Data.GraphViz.Attributes: instance Eq Attribute
+ Data.GraphViz.Attributes: instance Eq ColorType
+ Data.GraphViz.Attributes: instance Eq DirType
+ Data.GraphViz.Attributes: instance Eq Justification
+ Data.GraphViz.Attributes: instance Eq OutputMode
+ Data.GraphViz.Attributes: instance Eq PageDir
+ Data.GraphViz.Attributes: instance Eq Point
+ Data.GraphViz.Attributes: instance Eq PointList
+ Data.GraphViz.Attributes: instance Eq Rect
+ Data.GraphViz.Attributes: instance Eq ScaleType
+ Data.GraphViz.Attributes: instance Eq ShapeType
+ Data.GraphViz.Attributes: instance Eq StyleType
+ Data.GraphViz.Attributes: instance Eq VerticalPlacement
+ Data.GraphViz.Attributes: instance Show ColorType
+ Data.GraphViz.Attributes: readColorType :: Parser Char ColorType
- Data.GraphViz.Attributes: RGB :: Word8 -> Word8 -> Word8 -> ColourType
+ Data.GraphViz.Attributes: RGB :: Word8 -> Word8 -> Word8 -> ColorType
- Data.GraphViz.Attributes: RGBA :: Word8 -> Word8 -> Word8 -> Word8 -> ColourType
+ Data.GraphViz.Attributes: RGBA :: Word8 -> Word8 -> Word8 -> Word8 -> ColorType
- Data.GraphViz.Attributes: alpha :: ColourType -> Word8
+ Data.GraphViz.Attributes: alpha :: ColorType -> Word8
- Data.GraphViz.Attributes: blue :: ColourType -> Word8
+ Data.GraphViz.Attributes: blue :: ColorType -> Word8
- Data.GraphViz.Attributes: green :: ColourType -> Word8
+ Data.GraphViz.Attributes: green :: ColorType -> Word8
- Data.GraphViz.Attributes: red :: ColourType -> Word8
+ Data.GraphViz.Attributes: red :: ColorType -> Word8
Files
- Data/GraphViz.hs +9/−0
- Data/GraphViz/Attributes.hs +50/−23
- Data/GraphViz/ParserCombinators.hs +9/−0
- graphviz.cabal +1/−1
Data/GraphViz.hs view
@@ -2,6 +2,15 @@ , ScopedTypeVariables #-} + {- GraphViz ------------------------------------------------------\+ | |+ | Copyright (c) 2008, Matthew Sackman (matthew@wellquite.org) |+ | |+ | DisTract is freely distributable under the terms of a 3-Clause |+ | BSD-style license. |+ | |+ \-----------------------------------------------------------------}+ module Data.GraphViz ( graphToDot , graphToGraph
Data/GraphViz/Attributes.hs view
@@ -2,6 +2,15 @@ , PatternSignatures #-} + {- GraphViz ------------------------------------------------------\+ | |+ | Copyright (c) 2008, Matthew Sackman (matthew@wellquite.org) |+ | |+ | DisTract is freely distributable under the terms of a 3-Clause |+ | BSD-style license. |+ | |+ \-----------------------------------------------------------------}+ module Data.GraphViz.Attributes where import Prelude hiding (LT)@@ -24,6 +33,7 @@ | Box | OBox | Open | HalfOpen | Vee+ deriving (Eq) instance Show ArrowType where show Normal = "normal"@@ -69,7 +79,7 @@ , optionalQuotedString "vee" >> return Vee ] -data ColourType = RGB { red :: Word8+data ColorType = RGB { red :: Word8 , green :: Word8 , blue :: Word8 }@@ -78,8 +88,9 @@ , blue :: Word8 , alpha :: Word8 }+ deriving (Eq) -instance Show ColourType where+instance Show ColorType where show (RGB { red, green, blue }) = show $ '#' : foldr showWord8Pad "" [red, green, blue] show (RGBA { red, green, blue, alpha })@@ -96,8 +107,8 @@ | n < 16 = c | otherwise = findCols (c+1) (n `div` 16) -readColourType :: Parser Char ColourType-readColourType+readColorType :: Parser Char ColorType+readColorType = do { string "\"#" ; digits <- many $ noneOf ['"'] ; char '"'@@ -117,6 +128,7 @@ readHexPairs c = error $ "Error in readHexPairs: " ++ (show c) data DirType = Forward | Back | Both | None+ deriving (Eq) instance Show DirType where show Forward = "forward"@@ -133,6 +145,7 @@ ] data OutputMode = BreadthFirst | NodesFirst | EdgesFirst+ deriving (Eq) instance Show OutputMode where show BreadthFirst = "breadthfirst"@@ -147,6 +160,7 @@ ] data PageDir = BL | BR | TL | TR | RB | RT | LB | LT+ deriving (Eq) instance Show PageDir where show BL = "BL"@@ -203,6 +217,7 @@ | Folder | Box3d | Component+ deriving (Eq) instance Show ShapeType where show BoxShape = "box"@@ -275,6 +290,7 @@ ] data StyleType = Filled | Invisible | Diagonals | Rounded | Dashed | Dotted | Solid | Bold+ deriving (Eq) instance Show StyleType where show Filled = "filled"@@ -300,7 +316,10 @@ data Point = Point Int Int | PointD Double Double+ deriving (Eq)+ newtype PointList = PointList [Point]+ deriving (Eq) instance Show Point where show (Point x y) = show $ (show x) ++ (',':(show y))@@ -347,6 +366,7 @@ } data Rect = Rect Point Point+ deriving (Eq) instance Show Rect where show (Rect (Point x1 y1) (Point x2 y2))@@ -372,6 +392,7 @@ } data ScaleType = Scale | NoScale | FitX | FitY+ deriving (Eq) instance Show ScaleType where show Scale = "true"@@ -387,6 +408,7 @@ ] data Justification = JLeft | JRight | JCenter+ deriving (Eq) instance Show Justification where show JLeft = "l"@@ -400,6 +422,7 @@ ] data VerticalPlacement = VTop | VCenter | VBottom+ deriving (Eq) instance Show VerticalPlacement where show VTop = "t"@@ -418,18 +441,18 @@ | ArrowSize Double | ArrowTail ArrowType | Bb Rect- | BgColour ColourType+ | BgColor ColorType | Center Bool- | Colour ColourType+ | Color ColorType | Concentrate Bool | Constraint Bool | Decorate Bool | DefaultDist Double | Dir DirType | Dpi Double- | FillColour ColourType+ | FillColor ColorType | FixedSize Bool- | FontColour ColourType+ | FontColor ColorType | FontName String | FontSize Double | Group String@@ -442,7 +465,7 @@ | LabelAngle Double | LabelDistance Double | LabelFloat Bool- | LabelFontColour ColourType+ | LabelFontColor ColorType | LabelFontName String | LabelFontSize Double | LabelJust Justification@@ -461,7 +484,7 @@ | Pad Double Double | Page Double Double | PageDir PageDir- | PenColour ColourType+ | PenColor ColorType | Pos PointList | Quantum Double | RankDir PageDir@@ -482,24 +505,26 @@ | TailLabel String | Weight Double | Width Double+ | Unknown String String+ deriving (Eq) instance Show Attribute where show (ArrowHead arrowtype) = "arrowhead=" ++ (show arrowtype) show (ArrowSize double) = "arrowsize=" ++ (show double) show (ArrowTail arrowtype) = "arrowtail=" ++ (show arrowtype) show (Bb rect) = "bb=" ++ (show rect)- show (BgColour colourtype) = "bgcolour=" ++ (show colourtype)+ show (BgColor colortype) = "bgcolor=" ++ (show colortype) show (Center bool) = "center=" ++ (show bool)- show (Colour colourtype) = "colour=" ++ (show colourtype)+ show (Color colortype) = "color=" ++ (show colortype) show (Concentrate bool) = "concentrate=" ++ (show bool) show (Constraint bool) = "constraint=" ++ (show bool) show (Decorate bool) = "decorate=" ++ (show bool) show (DefaultDist double) = "defaultdist=" ++ (show double) show (Dir dirtype) = "dir=" ++ (show dirtype) show (Dpi double) = "dpi=" ++ (show double)- show (FillColour colourtype) = "fillcolour=" ++ (show colourtype)+ show (FillColor colortype) = "fillcolor=" ++ (show colortype) show (FixedSize bool) = "fixedsize=" ++ (show bool)- show (FontColour colourtype) = "fontcolour=" ++ (show colourtype)+ show (FontColor colortype) = "fontcolor=" ++ (show colortype) show (FontName string) = "fontname=" ++ (show string) show (FontSize double) = "fontsize=" ++ (show double) show (Group string) = "group=" ++ (show string)@@ -512,7 +537,7 @@ show (LabelAngle double) = "labelangle=" ++ (show double) show (LabelDistance double) = "labeldistance=" ++ (show double) show (LabelFloat bool) = "labelfloat=" ++ (show bool)- show (LabelFontColour colourtype) = "labelfontcolour=" ++ (show colourtype)+ show (LabelFontColor colortype) = "labelfontcolor=" ++ (show colortype) show (LabelFontName string) = "labelfontname=" ++ (show string) show (LabelFontSize double) = "labelfontsize=" ++ (show double) show (LabelJust justification) = "labeljust=" ++ (show justification)@@ -531,7 +556,7 @@ show (Pad double1 double2) = "pad=" ++ (show $ PointD double1 double2) show (Page double1 double2) = "page=" ++ (show $ PointD double1 double2) show (PageDir pagedir) = "pagedir=" ++ (show pagedir)- show (PenColour colourtype) = "pencolor=" ++ (show colourtype)+ show (PenColor colortype) = "pencolor=" ++ (show colortype) show (Pos pointlist) = "pos=" ++ (show pointlist) show (Quantum double) = "quantum=" ++ (show double) show (RankDir pagedir) = "rankdir=" ++ (show pagedir)@@ -552,6 +577,7 @@ show (TailLabel string) = "taillabel=" ++ (show string) show (Weight double) = "weight=" ++ (show double) show (Width double) = "width=" ++ (show double)+ show (Unknown key value) = (show key) ++ ('=':(show . show $ value)) readBool :: Parser Char Bool readBool = oneOf [ (optionalQuotedString "true" >> return True)@@ -568,7 +594,7 @@ ; char '"' ; return str }- nonquoted = many $ noneOf ['"', ' ', ',', '\t', '\n', '\r']+ nonquoted = many $ noneOf ['"', ' ', ',', '\t', '\n', '\r', ']'] readAttribute :: Parser Char Attribute readAttribute@@ -577,18 +603,18 @@ , string "arrowsize=" >> optionalQuoted floatingNumber >>= return . ArrowSize , string "arrowtail=" >> readArrowType >>= return . ArrowTail , string "bb=" >> readRect >>= return . Bb- , string "bgcolour=" >> readColourType >>= return . BgColour+ , string "bgcolor=" >> readColorType >>= return . BgColor , string "center=" >> readBool >>= return . Center- , string "colour=" >> readColourType >>= return . Colour+ , string "color=" >> readColorType >>= return . Color , string "concentrate=" >> readBool >>= return . Concentrate , string "constraint=" >> readBool >>= return . Constraint , string "decorate=" >> readBool >>= return . Decorate , string "defaultdist=" >> optionalQuoted floatingNumber >>= return . DefaultDist , string "dir=" >> readDirType >>= return . Dir , string "dpi=" >> optionalQuoted floatingNumber >>= return . Dpi- , string "fillcolour=" >> readColourType >>= return . FillColour+ , string "fillcolor=" >> readColorType >>= return . FillColor , string "fixedsize=" >> readBool >>= return . FixedSize- , string "fontcolour=" >> readColourType >>= return . FontColour+ , string "fontcolor=" >> readColorType >>= return . FontColor , string "fontname=" >> readString >>= return . FontName , string "fontsize=" >> optionalQuoted floatingNumber >>= return . FontSize , string "group=" >> readString >>= return . Group@@ -601,7 +627,7 @@ , string "labelangle=" >> optionalQuoted floatingNumber >>= return . LabelAngle , string "labeldistance=" >> optionalQuoted floatingNumber >>= return . LabelDistance , string "labelfloat=" >> readBool >>= return . LabelFloat- , string "labelfontcolour=" >> readColourType >>= return . LabelFontColour+ , string "labelfontcolor=" >> readColorType >>= return . LabelFontColor , string "labelfontname=" >> readString >>= return . LabelFontName , string "labelfontsize=" >> optionalQuoted floatingNumber >>= return . LabelFontSize , string "labeljust=" >> readJustification >>= return . LabelJust@@ -620,7 +646,7 @@ , string "pad=" >> readPoint >>= \(PointD x y) -> return $ Pad x y , string "page=" >> readPoint >>= \(PointD x y) -> return $ Page x y , string "pagedir=" >> readPageDir >>= return . PageDir- , string "pencolor=" >> readColourType >>= return . PenColour+ , string "pencolor=" >> readColorType >>= return . PenColor , string "pos=" >> readPointList >>= return . Pos , string "quantum=" >> optionalQuoted floatingNumber >>= return . Quantum , string "rankdir=" >> readPageDir >>= return . RankDir@@ -641,6 +667,7 @@ , string "taillabel=" >> readString >>= return . TailLabel , string "weight=" >> optionalQuoted floatingNumber >>= return . Weight , string "width=" >> optionalQuoted floatingNumber >>= return . Width+ , many (noneOf ['=', '"', ' ', ',', '\t', '\n', '\r', ']']) >>= \key -> char '=' >> readString >>= return . Unknown key ] readAttributesList :: Parser Char [Attribute]
Data/GraphViz/ParserCombinators.hs view
@@ -1,5 +1,14 @@ {-# LANGUAGE PatternSignatures #-} + {- GraphViz ------------------------------------------------------\+ | |+ | Copyright (c) 2008, Matthew Sackman (matthew@wellquite.org) |+ | |+ | DisTract is freely distributable under the terms of a 3-Clause |+ | BSD-style license. |+ | |+ \-----------------------------------------------------------------}+ module Data.GraphViz.ParserCombinators where import Text.ParserCombinators.PolyLazy
graphviz.cabal view
@@ -1,5 +1,5 @@ Name: graphviz-Version: 2008.7.10+Version: 2008.7.11 Stability: Beta Copyright: Matthew Sackman Category: Graphics