From e723b07d1e2ac9fd2df6598d43bd45c949891c6b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 11 May 2018 13:25:45 -0400 Subject: [PATCH] :fire: renderGraph. --- src/Analysis/Abstract/Graph.hs | 6 +----- src/Semantic/Graph.hs | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Analysis/Abstract/Graph.hs b/src/Analysis/Abstract/Graph.hs index 1483d8a15..62bfc5490 100644 --- a/src/Analysis/Abstract/Graph.hs +++ b/src/Analysis/Abstract/Graph.hs @@ -2,7 +2,7 @@ module Analysis.Abstract.Graph ( Graph(..) , Vertex(..) -, renderGraph +, style , appendGraph , variableDefinition , moduleInclusion @@ -38,10 +38,6 @@ data Vertex | Variable { vertexName :: ByteString } deriving (Eq, Ord, Show) --- | Render a 'Graph' to a 'ByteString' in DOT notation. -renderGraph :: Graph Vertex -> ByteString -renderGraph = export style - style :: Style Vertex ByteString style = (defaultStyle vertexName) { vertexAttributes = vertexAttributes diff --git a/src/Semantic/Graph.hs b/src/Semantic/Graph.hs index c80f6ec9b..f6f5604ae 100644 --- a/src/Semantic/Graph.hs +++ b/src/Semantic/Graph.hs @@ -1,6 +1,7 @@ {-# LANGUAGE GADTs, TypeOperators #-} module Semantic.Graph where +import Algebra.Graph.Export.Dot import Analysis.Abstract.Evaluating import Analysis.Abstract.Graph import Control.Monad.Effect.Trace @@ -39,7 +40,7 @@ graph graphType renderer project CallGraph -> graphingTerms analyze runGraphAnalysis (evaluatePackageWith graphingModules (withTermSpans . graphingLoadErrors . analyzeTerm) package) >>= extractGraph >>= case renderer of JSONGraphRenderer -> pure . toOutput - DOTGraphRenderer -> pure . renderGraph + DOTGraphRenderer -> pure . export style where extractGraph result = case result of (Right ((_, graph), _), _) -> pure graph _ -> Task.throwError (toException (Exc.ErrorCall ("graphImports: import graph rendering failed " <> show result)))