{-# OPTIONS -w -O0 #-}
{-# LANGUAGE CPP, StandaloneDeriving, DeriveDataTypeable, DeriveGeneric #-}
module ATC.ExtSign () where
import ATerm.Lib
import Common.ATerm.ConvInstances
import Common.Doc
import Common.DocUtils
import Common.ExtSign
import Common.Json.ConvInstances
import Common.Json.Instances
import Data.Aeson(ToJSON, FromJSON)
import Data.Data
import GHC.Generics(Generic)
import qualified Data.Set as Set
deriving instance GHC.Generics.Generic (Common.ExtSign.ExtSign sign symbol)
instance (Ord symbol, Data.Aeson.ToJSON sign,
Data.Aeson.ToJSON symbol) => Data.Aeson.ToJSON (Common.ExtSign.ExtSign sign symbol) where
instance (Ord symbol, Data.Aeson.FromJSON sign,
Data.Aeson.FromJSON symbol) => Data.Aeson.FromJSON (Common.ExtSign.ExtSign sign symbol) where
instance (Ord symbol, ShATermConvertible sign,
ShATermConvertible symbol) => ShATermConvertible (Common.ExtSign.ExtSign sign symbol) where
toShATermAux :: ATermTable -> ExtSign sign symbol -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: ExtSign sign symbol
xv = case ExtSign sign symbol
xv of
ExtSign a :: sign
a b :: Set symbol
b -> do
(att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> sign -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 sign
a
(att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Set symbol -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Set symbol
b
(ATermTable, Int) -> IO (ATermTable, Int)
forall (m :: * -> *) a. Monad m => a -> m a
return ((ATermTable, Int) -> IO (ATermTable, Int))
-> (ATermTable, Int) -> IO (ATermTable, Int)
forall a b. (a -> b) -> a -> b
$ ShATerm -> ATermTable -> (ATermTable, Int)
addATerm (String -> [Int] -> [Int] -> ShATerm
ShAAppl "ExtSign" [Int
a', Int
b'] []) ATermTable
att2
fromShATermAux :: Int -> ATermTable -> (ATermTable, ExtSign sign symbol)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
ShAAppl "ExtSign" [a :: Int
a, b :: Int
b] _ ->
case Int -> ATermTable -> (ATermTable, sign)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
{ (att1 :: ATermTable
att1, a' :: sign
a') ->
case Int -> ATermTable -> (ATermTable, Set symbol)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
{ (att2 :: ATermTable
att2, b' :: Set symbol
b') ->
(ATermTable
att2, sign -> Set symbol -> ExtSign sign symbol
forall sign symbol. sign -> Set symbol -> ExtSign sign symbol
ExtSign sign
a' Set symbol
b') }}
u :: ShATerm
u -> String -> ShATerm -> (ATermTable, ExtSign sign symbol)
forall a. String -> ShATerm -> a
fromShATermError "Common.ExtSign.ExtSign" ShATerm
u