diagrams-graphviz 1.3.0.0 → 1.3.0.1
raw patch · 3 files changed
+23/−11 lines, 3 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Diagrams.TwoD.GraphViz: layoutGraph :: Graph gr => GraphvizCommand -> gr v e -> IO (gr (AttributeNode v) (AttributeEdge e))
+ Diagrams.TwoD.GraphViz: layoutGraph :: forall gr v e. Graph gr => GraphvizCommand -> gr v e -> IO (gr (AttributeNode v) (AttributeEdge e))
Files
- CHANGES.markdown +6/−0
- diagrams-graphviz.cabal +6/−2
- src/Diagrams/TwoD/GraphViz.hs +11/−9
CHANGES.markdown view
@@ -1,3 +1,9 @@+1.3.0.1 (6 June 2016)+---------------------++- allow `base-4.9`+- test on GHC 8.0.1+ 1.3.0.0 (2015-09-18) --------------------
diagrams-graphviz.cabal view
@@ -1,5 +1,5 @@ name: diagrams-graphviz-version: 1.3.0.0+version: 1.3.0.1 synopsis: Graph layout and drawing with GrahpViz and diagrams description: Use GraphViz and diagrams together, with each doing what it does best: GraphViz for laying out graphs, and diagrams@@ -14,11 +14,15 @@ build-type: Simple extra-source-files: README.markdown, CHANGES.markdown cabal-version: >=1.10+Tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1+Source-repository head+ type: git+ location: git://github.com/diagrams/diagrams-graphviz.git library exposed-modules: Diagrams.TwoD.GraphViz other-extensions: FlexibleContexts, MultiParamTypeClasses, NoMonomorphismRestriction- build-depends: base >=4.6 && <4.9,+ build-depends: base >=4.6 && < 4.10, containers >= 0.4 && < 0.6, diagrams-lib >= 1.3 && < 1.4, graphviz >= 2999.17 && < 2999.19,
src/Diagrams/TwoD/GraphViz.hs view
@@ -106,7 +106,7 @@ import qualified Data.Graph.Inductive.Graph as G (Graph, Node, labEdges, labNodes, mkGraph) import Data.Graph.Inductive.PatriciaTree (Gr)-import Data.GraphViz hiding (Path)+import Data.GraphViz hiding (Path, attrs) import Data.GraphViz.Attributes.Complete as G (Attribute (Pos, Overlap, Splines), EdgeType (SplineEdges), Overlap (ScaleOverlaps), Point (..), Pos (..),@@ -117,8 +117,7 @@ import Data.List (group, sort) import Data.List.Split (chunksOf) import qualified Data.Map as M-import Data.Maybe (catMaybes, fromJust,- maybeToList)+import Data.Maybe (catMaybes, fromJust) import Data.Tuple (swap) -- | Construct a graph from a list of vertex labels (which must be unique) and@@ -151,15 +150,18 @@ getPath attrs = case [ss | Pos (SplinePos ss) <- attrs] of [splines] -> mconcat . map getSpline $ splines _ -> mempty- getSpline (Spline { startPoint = s, endPoint = e, splinePoints = pt1:pts}) = thePath+ getSpline (Spline { splinePoints = pt1:pts}) = thePath where ptGroups = chunksOf 3 (map pointToP2 pts) fixedBeziers = zipWith mkBez (pointToP2 pt1 : map last ptGroups) ptGroups mkBez x1 [c1,c2,x2] = FCubic x1 c1 c2 x2+ mkBez _ _ = error "Diagrams.TwoD.GraphViz.getGraph.mkBez: impossible!" thePath = fromLocSegments . fixup . map fromFixedSeg $ fixedBeziers fixup [] = [] `at` origin fixup (b1:rest) = (unLoc b1 : map unLoc rest) `at` loc b1+ getSpline _ = error "Diagrams.TwoD.GraphViz.getGraph: don't know what to do with empty spline!" + -- | Convert a GraphViz point to a diagrams point. pointToP2 :: G.Point -> P2 Double pointToP2 (G.Point {xCoord = x, yCoord = y}) = x ^& y@@ -208,9 +210,9 @@ -> GraphvizCommand -> gr v e -> IO (gr (AttributeNode v) (AttributeEdge e))-layoutGraph' params com gr = dotAttributes' com (isDirected params) gr' dot+layoutGraph' params com gr = dotAttributes' com (isDirected params) gr' asDot where- dot = graphToDot params' gr'+ asDot = graphToDot params' gr' params' = params { fmtEdge = setEdgeIDAttribute $ fmtEdge params } gr' = addEdgeIDs gr @@ -233,7 +235,7 @@ dotAttributes' :: (G.Graph gr, PPDotRepr dg G.Node, FromGeneralisedDot dg G.Node) => GraphvizCommand -> Bool -> gr v (EdgeID e) -> dg G.Node -> IO (gr (AttributeNode v) (AttributeEdge e))-dotAttributes' command isDir gr dot- = augmentGraph gr . parseDG <$> graphvizWithHandle command dot DotOutput hGetDot+dotAttributes' command _isDir gr asDot+ = augmentGraph gr . parseDG <$> graphvizWithHandle command asDot DotOutput hGetDot where- parseDG = (`asTypeOf` dot) . fromGeneralised+ parseDG = (`asTypeOf` asDot) . fromGeneralised