Skip to content

Commit

Permalink
use text (instead of integer) to represent special variable in SAT2NA…
Browse files Browse the repository at this point in the history
…ESATInfo's JSON encoding
  • Loading branch information
msakai committed Dec 4, 2024
1 parent 713ab77 commit f16c424
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ToySolver/Converter/NAESAT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ instance J.ToJSON SAT2NAESATInfo where
toJSON (SAT2NAESATInfo z) =
J.object
[ "type" .= ("SAT2NAESATInfo" :: J.Value)
, "special_variable" .= z
, "special_variable" .= jVar z
]

instance J.FromJSON SAT2NAESATInfo where
parseJSON = withTypedObject "SAT2NAESATInfo" $ \obj ->
SAT2NAESATInfo <$> obj .: "special_variable" -- TODO: use Text instead of Int
parseJSON = withTypedObject "SAT2NAESATInfo" $ \obj -> do
z <- parseVarName =<< (obj .: "special_variable")
pure $ SAT2NAESATInfo z

-- | Information of 'naesat2sat' conversion
type NAESAT2SATInfo = IdentityTransformer SAT.Model
Expand Down

0 comments on commit f16c424

Please sign in to comment.