From f16c424edc7c221f963863c40fcd91f5cf38eee7 Mon Sep 17 00:00:00 2001 From: Masahiro Sakai Date: Thu, 5 Dec 2024 08:28:07 +0900 Subject: [PATCH] use text (instead of integer) to represent special variable in SAT2NAESATInfo's JSON encoding --- src/ToySolver/Converter/NAESAT.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ToySolver/Converter/NAESAT.hs b/src/ToySolver/Converter/NAESAT.hs index 3b43c337..228dbe5c 100644 --- a/src/ToySolver/Converter/NAESAT.hs +++ b/src/ToySolver/Converter/NAESAT.hs @@ -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