diff --git a/src/Rendering/Renderer.hs b/src/Rendering/Renderer.hs index 622fb66ed..30ff01cbb 100644 --- a/src/Rendering/Renderer.hs +++ b/src/Rendering/Renderer.hs @@ -45,7 +45,7 @@ data DiffRenderer output where -- | Render to a 'ByteString' formatted as nested s-expressions with patches indicated. SExpressionDiffRenderer :: DiffRenderer ByteString -- | Render to a 'ByteString' formatted as a DOT description of the diff. - DOTDiffRenderer :: DiffRenderer ByteString + DOTDiffRenderer :: DiffRenderer Builder deriving instance Eq (DiffRenderer output) deriving instance Show (DiffRenderer output) diff --git a/src/Semantic/Diff.hs b/src/Semantic/Diff.hs index cd4562504..82debb0ae 100644 --- a/src/Semantic/Diff.hs +++ b/src/Semantic/Diff.hs @@ -1,7 +1,6 @@ {-# LANGUAGE GADTs #-} module Semantic.Diff where -import Algebra.Graph.Export.Dot import Analysis.ConstructorName (ConstructorName, constructorLabel) import Analysis.IdentifierName (IdentifierName, identifierLabel) import Analysis.Declaration (HasDeclaration, declarationAlgebra) @@ -20,6 +19,7 @@ import Rendering.Renderer import Semantic.IO (NoLanguageForBlob(..)) import Semantic.Stat as Stat import Semantic.Task as Task +import Serializing.Format diffBlobPairs :: (Members '[Distribute WrappedTask, Task, Telemetry, Exc SomeException, IO] effs, Output output) => DiffRenderer output -> [BlobPair] -> Eff effs ByteString diffBlobPairs renderer blobs = toOutput' <$> distributeFoldMap (WrapTask . diffBlobPair renderer) blobs @@ -35,7 +35,7 @@ diffBlobPair renderer blobs ToCDiffRenderer -> run (WrapTask . (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob))) diffTerms renderToCDiff JSONDiffRenderer -> run (WrapTask . ( parse parser >=> decorate constructorLabel >=> decorate identifierLabel)) diffTerms renderJSONDiff SExpressionDiffRenderer -> run (WrapTask . ( parse parser >=> decorate constructorLabel . (Nil <$))) diffTerms (const renderSExpressionDiff) - DOTDiffRenderer -> run (WrapTask . parse parser) diffTerms (const (export (diffStyle (pathKeyForBlobPair blobs)) . renderTreeGraph)) + DOTDiffRenderer -> run (WrapTask . parse parser) diffTerms (const renderTreeGraph) >>= serialize (DOT (diffStyle (pathKeyForBlobPair blobs))) | otherwise = throwError (SomeException (NoLanguageForBlob effectivePath)) where effectivePath = pathForBlobPair blobs effectiveLanguage = languageForBlobPair blobs