Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change --dump-info to output JSON #125

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -551,6 +551,7 @@ Executable toyconvert
Main-is: toyconvert.hs
HS-Source-Dirs: app
Build-Depends:
aeson,
base,
bytestring,
bytestring-builder,
Expand Down
Loading