IHaskell.Display.Graphviz: read directly from stdout

This commit is contained in:
Vaibhav Sagar 2019-01-02 16:20:35 -05:00
parent 22bb3677bc
commit 540b54d597

View File

@ -40,16 +40,5 @@ instance IHaskellDisplay Graphviz where
svgDisp <- graphDataSVG fig
return $ Display [svgDisp]
name = "ihaskell-graphviz."
graphDataSVG :: Graphviz -> IO DisplayData
graphDataSVG (Dot dotBody) = do
switchToTmpDir
let fname = name ++ "svg"
-- Write the image.
ret <- readProcess "dot" ["-Tsvg", "-o", fname] dotBody
-- Force strictness on readProcess, read file, and output as SVG
imgData <- seq (length ret) $ readFile fname
return $ svg imgData
graphDataSVG (Dot dotBody) = svg <$> readProcess "dot" ["-Tsvg"] dotBody