{-# LANGUAGE PartialTypeSignatures , FlexibleContexts, DeriveGeneric, StandaloneDeriving, StrictData #-}
module OutputGeneration.JSON (
generate_json
) where
import Base
import Data.SValue
import Data.SymbolicExpression
import Data.JSON_Taxonomy
import Analysis.Context as C
import Analysis.Pointers
import Analysis.ControlFlow
import OutputGeneration.Retrieval
import Generic.HasSize
import Generic.Binary
import Generic.SymbolicConstituents
import Generic.Instruction
import Generic.Operand
import X86.Opcode
import X86.Prefix
import X86.Register
import qualified Data.Map as M
import qualified Data.IntMap as IM
import qualified Data.IntSet as IS
import qualified Data.Set as S
import Data.Maybe (fromJust,catMaybes,mapMaybe)
import Data.List
import Data.Foldable
import Data.Word
import System.IO.Unsafe (unsafePerformIO)
import Control.Monad (when)
import qualified Data.ByteString as BS
import Data.ByteString.Lazy (writeFile)
import qualified Data.Serialize as Cereal hiding (get,put)
import Blaze.ByteString.Builder
import Blaze.ByteString.Builder.Char.Utf8 (fromString)
import Data.Aeson
import GHC.Generics
import Debug.Trace
generate_json ::
Context
-> String
-> String
-> Bool
-> IO ()
generate_json :: Context -> String -> String -> Bool -> IO ()
generate_json Context
ctxt String
fname_plain String
fname_json Bool
verbose = do
let entries :: Set Int
entries = Context -> Set Int
ctxt_get_function_entries Context
ctxt
let instrs :: [Instruction]
instrs = Set Instruction -> [Instruction]
forall a. Set a -> [a]
S.toList (Set Instruction -> [Instruction])
-> Set Instruction -> [Instruction]
forall a b. (a -> b) -> a -> b
$ Context -> Set Instruction
ctxt_get_instructions Context
ctxt
let addresses :: [Word64]
addresses = Set Word64 -> [Word64]
forall a. Set a -> [a]
S.toList (Set Word64 -> [Word64]) -> Set Word64 -> [Word64]
forall a b. (a -> b) -> a -> b
$ Context -> Set Word64
ctxt_get_instruction_addresses Context
ctxt
[(Word64, [Word64])]
control_flow <- (Word64 -> IO (Word64, [Word64]))
-> [Word64] -> IO [(Word64, [Word64])]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Context -> Word64 -> IO (Word64, [Word64])
ctxt_get_controlflow Context
ctxt) [Word64]
addresses
let boundaries :: [(Word64, String)]
boundaries = (Int -> (Word64, String)) -> [Int] -> [(Word64, String)]
forall a b. (a -> b) -> [a] -> [b]
map (Context -> Int -> (Word64, String)
forall a. Num a => Context -> Int -> (a, String)
ctxt_mk_function_boundary Context
ctxt) ([Int] -> [(Word64, String)]) -> [Int] -> [(Word64, String)]
forall a b. (a -> b) -> a -> b
$ Set Int -> [Int]
forall a. Set a -> [a]
S.toList Set Int
entries
let summaries :: [(Word64, (FInit, Maybe FReturnBehavior))]
summaries = (Int -> (Word64, (FInit, Maybe FReturnBehavior)))
-> [Int] -> [(Word64, (FInit, Maybe FReturnBehavior))]
forall a b. (a -> b) -> [a] -> [b]
map (Context -> Int -> (Word64, (FInit, Maybe FReturnBehavior))
forall a.
Num a =>
Context -> Int -> (a, (FInit, Maybe FReturnBehavior))
ctxt_get_function_summary Context
ctxt) ([Int] -> [(Word64, (FInit, Maybe FReturnBehavior))])
-> [Int] -> [(Word64, (FInit, Maybe FReturnBehavior))]
forall a b. (a -> b) -> a -> b
$ Set Int -> [Int]
forall a. Set a -> [a]
S.toList Set Int
entries
let mem_ops :: [(Word64, Word64, [Maybe SValue])]
mem_ops = Context -> [(Word64, Word64, [Maybe SValue])]
ctxt_resolve_mem_operands Context
ctxt
let invs :: [(Word64, Maybe [(Word64, Predicate)])]
invs = if Bool
verbose then (Word64 -> (Word64, Maybe [(Word64, Predicate)]))
-> [Word64] -> [(Word64, Maybe [(Word64, Predicate)])]
forall a b. (a -> b) -> [a] -> [b]
map (Context -> Word64 -> (Word64, Maybe [(Word64, Predicate)])
ctxt_get_inv Context
ctxt) ([Word64] -> [(Word64, Maybe [(Word64, Predicate)])])
-> [Word64] -> [(Word64, Maybe [(Word64, Predicate)])]
forall a b. (a -> b) -> a -> b
$ [Word64]
addresses else []
let pp_text :: ByteString
pp_text = Builder -> ByteString
toByteString (Builder -> ByteString) -> Builder -> ByteString
forall a b. (a -> b) -> a -> b
$ [Builder] -> Builder
forall a. Monoid a => [a] -> a
mconcat ([Builder] -> Builder) -> [Builder] -> Builder
forall a b. (a -> b) -> a -> b
$ (String -> Builder) -> [String] -> [Builder]
forall a b. (a -> b) -> [a] -> [b]
map String -> Builder
fromString ([String] -> [Builder]) -> [String] -> [Builder]
forall a b. (a -> b) -> a -> b
$ Context
-> Bool
-> [Instruction]
-> [(Word64, [Word64])]
-> [(Word64, String)]
-> [(Word64, (FInit, Maybe FReturnBehavior))]
-> [(Word64, Word64, [Maybe SValue])]
-> [(Word64, Maybe [(Word64, Predicate)])]
-> [String]
forall a a a.
(Integral a, Integral a, Show a, Show a, Show a) =>
Context
-> Bool
-> [Instruction]
-> [(Word64, [Word64])]
-> [(Word64, String)]
-> [(Word64, (FInit, Maybe FReturnBehavior))]
-> [(a, a, [Maybe a])]
-> [(Word64, Maybe [(Word64, Predicate)])]
-> [String]
pp_json Context
ctxt Bool
verbose [Instruction]
instrs [(Word64, [Word64])]
control_flow [(Word64, String)]
boundaries [(Word64, (FInit, Maybe FReturnBehavior))]
summaries [(Word64, Word64, [Maybe SValue])]
mem_ops [(Word64, Maybe [(Word64, Predicate)])]
invs
String -> ByteString -> IO ()
BS.writeFile String
fname_plain ByteString
pp_text
let json_instructions :: [Instruction]
json_instructions = (Instruction -> Instruction) -> [Instruction] -> [Instruction]
forall a b. (a -> b) -> [a] -> [b]
map Instruction -> Instruction
forall annotation.
HasSize
(GenericInstruction
AddressWord64 Register Prefix Opcode annotation) =>
GenericInstruction AddressWord64 Register Prefix Opcode annotation
-> Instruction
mk_json_instruction [Instruction]
instrs
let json_summaries :: [(Word64, FunctionSummary)]
json_summaries = ((Word64, (FInit, Maybe FReturnBehavior))
-> (Word64, FunctionSummary))
-> [(Word64, (FInit, Maybe FReturnBehavior))]
-> [(Word64, FunctionSummary)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Word64
a,(FInit
finit,Maybe FReturnBehavior
post)) -> (Word64
a,String -> Postcondition -> FunctionSummary
FunctionSummary (FInit -> String
forall a. Show a => a -> String
show FInit
finit) (Postcondition -> FunctionSummary)
-> Postcondition -> FunctionSummary
forall a b. (a -> b) -> a -> b
$ Maybe FReturnBehavior -> Postcondition
mk_json_post Maybe FReturnBehavior
post)) [(Word64, (FInit, Maybe FReturnBehavior))]
summaries
let json_invs :: [(Word64, [(Word64, Predicate)])]
json_invs = if Bool
verbose then ((Word64, Maybe [(Word64, Predicate)])
-> (Word64, [(Word64, Predicate)]))
-> [(Word64, Maybe [(Word64, Predicate)])]
-> [(Word64, [(Word64, Predicate)])]
forall a b. (a -> b) -> [a] -> [b]
map (\(Word64
a,Just [(Word64, Predicate)]
invs) -> (Word64
a,((Word64, Predicate) -> (Word64, Predicate))
-> [(Word64, Predicate)] -> [(Word64, Predicate)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Word64
entry,Predicate
inv) -> (Word64
entry,Predicate -> Predicate
mk_json_predicate Predicate
inv)) [(Word64, Predicate)]
invs)) ([(Word64, Maybe [(Word64, Predicate)])]
-> [(Word64, [(Word64, Predicate)])])
-> [(Word64, Maybe [(Word64, Predicate)])]
-> [(Word64, [(Word64, Predicate)])]
forall a b. (a -> b) -> a -> b
$ ((Word64, Maybe [(Word64, Predicate)]) -> Bool)
-> [(Word64, Maybe [(Word64, Predicate)])]
-> [(Word64, Maybe [(Word64, Predicate)])]
forall a. (a -> Bool) -> [a] -> [a]
filter ((Maybe [(Word64, Predicate)] -> Maybe [(Word64, Predicate)] -> Bool
forall a. Eq a => a -> a -> Bool
(/=) Maybe [(Word64, Predicate)]
forall a. Maybe a
Nothing) (Maybe [(Word64, Predicate)] -> Bool)
-> ((Word64, Maybe [(Word64, Predicate)])
-> Maybe [(Word64, Predicate)])
-> (Word64, Maybe [(Word64, Predicate)])
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word64, Maybe [(Word64, Predicate)])
-> Maybe [(Word64, Predicate)]
forall a b. (a, b) -> b
snd) [(Word64, Maybe [(Word64, Predicate)])]
invs else []
let json :: JSON
json = [Instruction]
-> [(Word64, [Word64])]
-> [(Word64, String)]
-> [(Word64, FunctionSummary)]
-> [(Word64, [(Word64, Predicate)])]
-> [(Word64, Word64, [Maybe SValue])]
-> JSON
JSON [Instruction]
json_instructions [(Word64, [Word64])]
control_flow [(Word64, String)]
boundaries [(Word64, FunctionSummary)]
json_summaries [(Word64, [(Word64, Predicate)])]
json_invs [(Word64, Word64, [Maybe SValue])]
mem_ops
String -> ByteString -> IO ()
Data.ByteString.Lazy.writeFile String
fname_json (ByteString -> IO ()) -> ByteString -> IO ()
forall a b. (a -> b) -> a -> b
$ JSON -> ByteString
forall a. ToJSON a => a -> ByteString
encode JSON
json
pp_json :: Context
-> Bool
-> [Instruction]
-> [(Word64, [Word64])]
-> [(Word64, String)]
-> [(Word64, (FInit, Maybe FReturnBehavior))]
-> [(a, a, [Maybe a])]
-> [(Word64, Maybe [(Word64, Predicate)])]
-> [String]
pp_json Context
ctxt Bool
verbose [Instruction]
instrs [(Word64, [Word64])]
control_flow [(Word64, String)]
boundaries [(Word64, (FInit, Maybe FReturnBehavior))]
summaries [(a, a, [Maybe a])]
mem_ops [(Word64, Maybe [(Word64, Predicate)])]
invs = (String -> String) -> [String] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (String -> String -> String
forall a. [a] -> [a] -> [a]
(++) String
"\n") ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$
[ String
"------------"
, String
"INSTRUCTIONS"
, String
"------------"]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ (Instruction -> String) -> [Instruction] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (Context -> Instruction -> String
pp_instruction Context
ctxt) [Instruction]
instrs [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
[ String
"\n\n"
, String
"------------"
, String
"CONTROL FLOW"
, String
"------------"]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [(Word64, [Word64])] -> [String]
pp_control_flow [(Word64, [Word64])]
control_flow [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
[ String
"\n\n"
, String
"-------------------"
, String
"FUNCTION BOUNDARIES"
, String
"-------------------" ]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [(Word64, String)] -> [String]
pp_boundaries [(Word64, String)]
boundaries [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
[ String
"\n\n"
, String
"------------------"
, String
"FUNCTION SUMMARIES"
, String
"------------------" ]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [(Word64, (FInit, Maybe FReturnBehavior))] -> [String]
pp_summaries [(Word64, (FInit, Maybe FReturnBehavior))]
summaries [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
[ String
"\n\n"
, String
"---------------"
, String
"POINTER DOMAINS"
, String
"---------------" ]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ Context -> [(a, a, [Maybe a])] -> [String]
forall a a a p.
(Integral a, Integral a, Show a, Show a, Show a) =>
p -> [(a, a, [Maybe a])] -> [String]
pp_mem_ops Context
ctxt [(a, a, [Maybe a])]
mem_ops [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
[ String
"\n\n" ]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
if Bool
verbose then
[ String
"----------"
, String
"INVARIANTS"
, String
"----------"]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [(Word64, Maybe [(Word64, Predicate)])] -> [String]
pp_invs [(Word64, Maybe [(Word64, Predicate)])]
invs [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
[ String
"\n\n"]
else []
pp_invs :: [(Word64, Maybe [(Word64, Predicate)])] -> [String]
pp_invs = ((Word64, Maybe [(Word64, Predicate)]) -> String)
-> [(Word64, Maybe [(Word64, Predicate)])] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (Word64, Maybe [(Word64, Predicate)]) -> String
forall a a a.
(Integral a, Integral a, Show a, Show a, Show a) =>
(a, Maybe [(a, a)]) -> String
pp
where
pp :: (a, Maybe [(a, a)]) -> String
pp (a
a,Maybe [(a, a)]
Nothing) = String
"Address " String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
a String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
": no invariant.\n"
pp (a
a,Just [(a, a)]
invs) = String
"Address " String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
a String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
":\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n\n\n" (((a, a) -> String) -> [(a, a)] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (a, a) -> String
forall a a. (Integral a, Show a, Show a) => (a, a) -> String
pp_inv [(a, a)]
invs) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
pp_inv :: (a, a) -> String
pp_inv (a
entry,a
inv) = String
"Entry: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
entry String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
":\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
inv String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
pp_control_flow :: [(Word64,[Word64])] -> [String]
pp_control_flow :: [(Word64, [Word64])] -> [String]
pp_control_flow = ((Word64, [Word64]) -> String) -> [(Word64, [Word64])] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (Word64, [Word64]) -> String
forall a a.
(Integral a, Integral a, Show a, Show a) =>
(a, [a]) -> String
pp
where
pp :: (a, [a]) -> String
pp (a
a,[a]
as) = a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
a String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" --> " String -> String -> String
forall a. [a] -> [a] -> [a]
++ [a] -> String
forall a. (Integral a, Show a) => [a] -> String
showHex_list [a]
as
pp_boundaries :: [(Word64,String)] -> [String]
pp_boundaries :: [(Word64, String)] -> [String]
pp_boundaries = ((Word64, String) -> String) -> [(Word64, String)] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (Word64, String) -> String
forall a. (Integral a, Show a) => (a, String) -> String
pp
where
pp :: (a, String) -> String
pp (a
a,String
s) = a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
a String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
": " String -> String -> String
forall a. [a] -> [a] -> [a]
++ (Char -> Char) -> String -> String
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
repl String
s
repl :: Char -> Char
repl Char
'\n' = Char
';'
repl Char
c = Char
c
pp_summaries :: [(Word64, (FInit, Maybe FReturnBehavior))] -> [String]
pp_summaries = ((Word64, (FInit, Maybe FReturnBehavior)) -> String)
-> [(Word64, (FInit, Maybe FReturnBehavior))] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (Word64, (FInit, Maybe FReturnBehavior)) -> String
forall a.
(Integral a, Show a) =>
(a, (FInit, Maybe FReturnBehavior)) -> String
pp
where
pp :: (a, (FInit, Maybe FReturnBehavior)) -> String
pp (a
a,(FInit
finit,Maybe FReturnBehavior
post)) = String
"Entry: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
a String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FInit -> String
pp_finit FInit
finit String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Maybe FReturnBehavior -> String
pp_post Maybe FReturnBehavior
post
pp_post :: Maybe FReturnBehavior -> String
pp_post (Just FReturnBehavior
C.UnknownRetBehavior) = String
"Unknown return behavior" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
pp_post (Just FReturnBehavior
C.Terminating) = String
"Terminal" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
pp_post (Just (C.ReturningWith Predicate
q)) = String
"Returns with postcondition:\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Predicate -> String
forall a. Show a => a -> String
show Predicate
q
pp_finit :: FInit -> String
pp_finit FInit
finit = if FInit
finit FInit -> FInit -> Bool
forall a. Eq a => a -> a -> Bool
== FInit
init_finit then String
"No precondition" else String
"Precondition:\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FInit -> String
forall a. Show a => a -> String
show FInit
finit
pp_mem_ops :: p -> [(a, a, [Maybe a])] -> [String]
pp_mem_ops p
ctxt = ((a, a, [Maybe a]) -> String) -> [(a, a, [Maybe a])] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (a, a, [Maybe a]) -> String
forall a a a.
(Integral a, Integral a, Show a, Show a, Show a) =>
(a, a, [Maybe a]) -> String
pp
where
pp :: (a, a, [Maybe a]) -> String
pp (a
entry,a
a,[Maybe a]
es) = String
"Address " String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
a String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", entry: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. (Integral a, Show a) => a -> String
showHex a
entry String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
": [" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"," ((Maybe a -> String) -> [Maybe a] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Maybe a -> String
forall a. Show a => Maybe a -> String
pp_dom [Maybe a]
es) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"]"
pp_dom :: Maybe a -> String
pp_dom Maybe a
Nothing = String
"_"
pp_dom (Just a
e) = a -> String
forall a. Show a => a -> String
show a
e
instance ToJSON Register where
toJSON :: Register -> Value
toJSON = Options -> Register -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON Address where
toJSON :: Address -> Value
toJSON = Options -> Address -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON Operand where
toJSON :: Operand -> Value
toJSON = Options -> Operand -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON Opcode where
toJSON :: Opcode -> Value
toJSON = Options -> Opcode -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON Prefix where
toJSON :: Prefix -> Value
toJSON = Options -> Prefix -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON Instruction where
toJSON :: Instruction -> Value
toJSON = Options -> Instruction -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON BotSrc where
toJSON :: BotSrc -> Value
toJSON = Options -> BotSrc -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON PointerBase where
toJSON :: PointerBase -> Value
toJSON = Options -> PointerBase -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON BotTyp where
toJSON :: BotTyp -> Value
toJSON = Options -> BotTyp -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON Operator where
toJSON :: Operator -> Value
toJSON = Options -> Operator -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSONKey StatePart
instance ToJSON StatePart where
toJSON :: StatePart -> Value
toJSON = Options -> StatePart -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON SimpleExpr where
toJSON :: SimpleExpr -> Value
toJSON = Options -> SimpleExpr -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON Postcondition where
toJSON :: Postcondition -> Value
toJSON = Options -> Postcondition -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON FunctionSummary where
toJSON :: FunctionSummary -> Value
toJSON = Options -> FunctionSummary -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON PointerDomain where
toJSON :: PointerDomain -> Value
toJSON = Options -> PointerDomain -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON PtrOffset where
toJSON :: PtrOffset -> Value
toJSON = Options -> PtrOffset -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON SAddend where
toJSON :: SAddend -> Value
toJSON = Options -> SAddend -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON SPointer where
toJSON :: SPointer -> Value
toJSON = Options -> SPointer -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON SValue where
toJSON :: SValue -> Value
toJSON = Options -> SValue -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }
instance ToJSON JSON where
toJSON :: JSON -> Value
toJSON = Options -> JSON -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
defaultOptions { sumEncoding :: SumEncoding
sumEncoding = SumEncoding
ObjectWithSingleField }