Skip to content

Commit

Permalink
change --dump-info to output JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
msakai committed Nov 24, 2024
1 parent c125105 commit cee6747
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/toyconvert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module Main where

import Control.Applicative
import Control.Monad
import qualified Data.Aeson as J
import qualified Data.ByteString.Builder as ByteStringBuilder
import Data.Char
import Data.Default.Class
Expand Down Expand Up @@ -259,7 +260,7 @@ supportedFormatsDoc =
#endif

data Trail sol where
Trail :: Transformer a => a -> Trail (Target a)
Trail :: (Transformer a, J.ToJSON a) => a -> Trail (Target a)

data Problem
= ProbOPB PBFile.Formula (Trail SAT.Model)
Expand Down Expand Up @@ -390,10 +391,10 @@ writeProblem o problem = do
, MIP2SMT.optOptimize = optSMTOptimize o
}

writeInfo :: Transformer a => a -> IO ()
writeInfo :: (Transformer a, J.ToJSON a) => a -> IO ()
writeInfo info =
case optInfoOutput o of
Just fname -> writeFile fname (show info)
Just fname -> J.encodeFile fname info
Nothing -> return ()

writeInfo' :: Trail a -> IO ()
Expand Down
1 change: 1 addition & 0 deletions toysolver.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ Executable toyconvert
Main-is: toyconvert.hs
HS-Source-Dirs: app
Build-Depends:
aeson,
base,
bytestring,
bytestring-builder,
Expand Down

0 comments on commit cee6747

Please sign in to comment.