Skip to content

Commit 5652076

Browse files
committed
remove direct to svg for dot
1 parent 5f312b9 commit 5652076

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

arithmetic-circuits.cabal

+1-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ common deps
4949
, filepath >=1.4.2
5050
, finite-typelits >=0.1.0
5151
, galois-field >=2.0.0
52-
, process
5352
, propagators
5453
, protolude >=0.2
5554
, semirings >=0.7
@@ -114,7 +113,6 @@ library circom-compat
114113
build-depends:
115114
arithmetic-circuits
116115
, arithmetic-circuits:language
117-
, binary
118116
, bytestring
119117
, directory
120118
, optparse-applicative
@@ -171,8 +169,7 @@ executable factors
171169
import: warnings, extensions, deps
172170
main-is: Main.hs
173171
build-depends:
174-
binary
175-
, arithmetic-circuits
172+
arithmetic-circuits
176173
, arithmetic-circuits:language
177174
, arithmetic-circuits:circom-compat
178175
, vector
@@ -232,7 +229,6 @@ test-suite circom-compat-tests
232229
, tasty-quickcheck >=0.10
233230
, hspec
234231
, QuickCheck
235-
, binary
236232

237233
build-tool-depends: tasty-discover:tasty-discover >=4.2
238234

circuit/src/Circuit/Dot.hs

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
-- | Visualise circuits using Graphviz
22
module Circuit.Dot
33
( arithCircuitToDot,
4-
dotWriteSVG,
54
)
65
where
76

87
import Circuit.Affine ()
98
import Circuit.Arithmetic (ArithCircuit (..), Gate (..), Wire (..), booleanWires)
109
import Data.Text qualified as Text
1110
import Protolude
12-
import System.FilePath (replaceExtension)
13-
import System.Process (readProcessWithExitCode)
1411
import Text.PrettyPrint.Leijen.Text (Pretty (..))
1512

1613
arithCircuitToDot ::
@@ -78,12 +75,4 @@ arithCircuitToDot c@(ArithCircuit gates) =
7875
++ map (\output -> dotArrow gateLabel (dotWire output)) outputs
7976
where
8077
gateLabel = Text.concat . fmap dotWire $ outputs
81-
graphGate (Boolean _) = []
82-
83-
callDot :: Text -> IO Text
84-
callDot g = do
85-
(_, out, err) <- readProcessWithExitCode "dot" ["-Tsvg"] (Text.unpack g)
86-
if err == "" then pure (Text.pack out) else panic (Text.pack err)
87-
88-
dotWriteSVG :: FilePath -> Text -> IO ()
89-
dotWriteSVG path = callDot >=> writeFile (replaceExtension path ".svg")
78+
graphGate (Boolean _) = []

0 commit comments

Comments
 (0)