{-# OPTIONS -w -O0 #-}
{-# LANGUAGE CPP, StandaloneDeriving, DeriveDataTypeable, DeriveGeneric #-}
{- |
Module      :  Adl/ATC_Adl.der.hs
Description :  generated ShATermConvertible, Json instances
Copyright   :  (c) DFKI GmbH 2012
License     :  GPLv2 or higher, see LICENSE.txt

Maintainer  :  Christian.Maeder@dfki.de
Stability   :  provisional
Portability :  non-portable(derive Typeable instances)

Automatic derivation of instances via DrIFT-rule ShATermConvertible, Json
  for the type(s):
'Adl.As.Concept'
'Adl.As.RelType'
'Adl.As.Relation'
'Adl.As.UnOp'
'Adl.As.MulOp'
'Adl.As.Rule'
'Adl.As.Prop'
'Adl.As.RangedProp'
'Adl.As.Object'
'Adl.As.KeyAtt'
'Adl.As.KeyDef'
'Adl.As.RuleKind'
'Adl.As.RuleHeader'
'Adl.As.Pair'
'Adl.As.Plugin'
'Adl.As.PatElem'
'Adl.As.Context'
'Adl.Sign.Sign'
'Adl.Sign.Symbol'
'Adl.Sign.SymbolKind'
'Adl.Sign.RawSymbol'
'Adl.Sign.Sen'
-}

{-
Generated by 'genRules' (automatic rule generation for DrIFT). Don't touch!!
  dependency files:
Adl/As.hs
Adl/Sign.hs
-}

module Adl.ATC_Adl () where

import ATC.AS_Annotation
import ATerm.Lib
import Adl.As
import Adl.Print ()
import Adl.Sign
import Common.AS_Annotation
import Common.Doc
import Common.DocUtils
import Common.Id
import Common.Json.Instances
import Common.Keywords
import Common.Result
import Data.Aeson(ToJSON, FromJSON)
import Data.Char
import Data.Data
import Data.List (sortBy)
import GHC.Generics(Generic)
import qualified Common.Lib.Rel as Rel
import qualified Data.Map as Map
import qualified Data.Set as Set

{-! for Adl.As.Concept derive : ShATermConvertible !-}
{-! for Adl.As.RelType derive : ShATermConvertible !-}
{-! for Adl.As.Relation derive : ShATermConvertible !-}
{-! for Adl.As.UnOp derive : ShATermConvertible !-}
{-! for Adl.As.MulOp derive : ShATermConvertible !-}
{-! for Adl.As.Rule derive : ShATermConvertible !-}
{-! for Adl.As.Prop derive : ShATermConvertible !-}
{-! for Adl.As.RangedProp derive : ShATermConvertible !-}
{-! for Adl.As.Object derive : ShATermConvertible !-}
{-! for Adl.As.KeyAtt derive : ShATermConvertible !-}
{-! for Adl.As.KeyDef derive : ShATermConvertible !-}
{-! for Adl.As.RuleKind derive : ShATermConvertible !-}
{-! for Adl.As.RuleHeader derive : ShATermConvertible !-}
{-! for Adl.As.Pair derive : ShATermConvertible !-}
{-! for Adl.As.Plugin derive : ShATermConvertible !-}
{-! for Adl.As.PatElem derive : ShATermConvertible !-}
{-! for Adl.As.Context derive : ShATermConvertible !-}
{-! for Adl.Sign.Sign derive : ShATermConvertible !-}
{-! for Adl.Sign.Symbol derive : ShATermConvertible !-}
{-! for Adl.Sign.SymbolKind derive : ShATermConvertible !-}
{-! for Adl.Sign.RawSymbol derive : ShATermConvertible !-}
{-! for Adl.Sign.Sen derive : ShATermConvertible !-}

{-! for Adl.As.Concept derive : Json !-}
{-! for Adl.As.RelType derive : Json !-}
{-! for Adl.As.Relation derive : Json !-}
{-! for Adl.As.UnOp derive : Json !-}
{-! for Adl.As.MulOp derive : Json !-}
{-! for Adl.As.Rule derive : Json !-}
{-! for Adl.As.Prop derive : Json !-}
{-! for Adl.As.RangedProp derive : Json !-}
{-! for Adl.As.Object derive : Json !-}
{-! for Adl.As.KeyAtt derive : Json !-}
{-! for Adl.As.KeyDef derive : Json !-}
{-! for Adl.As.RuleKind derive : Json !-}
{-! for Adl.As.RuleHeader derive : Json !-}
{-! for Adl.As.Pair derive : Json !-}
{-! for Adl.As.Plugin derive : Json !-}
{-! for Adl.As.PatElem derive : Json !-}
{-! for Adl.As.Context derive : Json !-}
{-! for Adl.Sign.Sign derive : Json !-}
{-! for Adl.Sign.Symbol derive : Json !-}
{-! for Adl.Sign.SymbolKind derive : Json !-}
{-! for Adl.Sign.RawSymbol derive : Json !-}
{-! for Adl.Sign.Sen derive : Json !-}

-- Generated by DrIFT, look but don't touch!

deriving instance GHC.Generics.Generic Adl.As.Context
instance Data.Aeson.ToJSON Adl.As.Context where
instance Data.Aeson.FromJSON Adl.As.Context where

deriving instance GHC.Generics.Generic Adl.As.PatElem
instance Data.Aeson.ToJSON Adl.As.PatElem where
instance Data.Aeson.FromJSON Adl.As.PatElem where

deriving instance GHC.Generics.Generic Adl.As.Plugin
instance Data.Aeson.ToJSON Adl.As.Plugin where
instance Data.Aeson.FromJSON Adl.As.Plugin where

deriving instance GHC.Generics.Generic Adl.As.Pair
instance Data.Aeson.ToJSON Adl.As.Pair where
instance Data.Aeson.FromJSON Adl.As.Pair where

deriving instance GHC.Generics.Generic Adl.As.RuleHeader
instance Data.Aeson.ToJSON Adl.As.RuleHeader where
instance Data.Aeson.FromJSON Adl.As.RuleHeader where

deriving instance GHC.Generics.Generic Adl.As.RuleKind
instance Data.Aeson.ToJSON Adl.As.RuleKind where
instance Data.Aeson.FromJSON Adl.As.RuleKind where

deriving instance GHC.Generics.Generic Adl.As.KeyDef
instance Data.Aeson.ToJSON Adl.As.KeyDef where
instance Data.Aeson.FromJSON Adl.As.KeyDef where

deriving instance GHC.Generics.Generic Adl.As.KeyAtt
instance Data.Aeson.ToJSON Adl.As.KeyAtt where
instance Data.Aeson.FromJSON Adl.As.KeyAtt where

deriving instance GHC.Generics.Generic Adl.As.Object
instance Data.Aeson.ToJSON Adl.As.Object where
instance Data.Aeson.FromJSON Adl.As.Object where

deriving instance GHC.Generics.Generic Adl.As.RangedProp
instance Data.Aeson.ToJSON Adl.As.RangedProp where
instance Data.Aeson.FromJSON Adl.As.RangedProp where

deriving instance GHC.Generics.Generic Adl.As.Prop
instance Data.Aeson.ToJSON Adl.As.Prop where
instance Data.Aeson.FromJSON Adl.As.Prop where

deriving instance GHC.Generics.Generic Adl.As.Rule
instance Data.Aeson.ToJSON Adl.As.Rule where
instance Data.Aeson.FromJSON Adl.As.Rule where

deriving instance GHC.Generics.Generic Adl.As.MulOp
instance Data.Aeson.ToJSON Adl.As.MulOp where
instance Data.Aeson.FromJSON Adl.As.MulOp where

deriving instance GHC.Generics.Generic Adl.As.UnOp
instance Data.Aeson.ToJSON Adl.As.UnOp where
instance Data.Aeson.FromJSON Adl.As.UnOp where

deriving instance GHC.Generics.Generic Adl.As.Relation
instance Data.Aeson.ToJSON Adl.As.Relation where
instance Data.Aeson.FromJSON Adl.As.Relation where

deriving instance GHC.Generics.Generic Adl.As.RelType
instance Data.Aeson.ToJSON Adl.As.RelType where
instance Data.Aeson.FromJSON Adl.As.RelType where

deriving instance GHC.Generics.Generic Adl.As.Concept
instance Data.Aeson.ToJSON Adl.As.Concept where
instance Data.Aeson.FromJSON Adl.As.Concept where

instance ShATermConvertible Adl.As.Context where
  toShATermAux :: ATermTable -> Context -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Context
xv = case Context
xv of
    Context a :: Maybe Token
a b :: [PatElem]
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Maybe Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Maybe Token
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> [PatElem] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 [PatElem]
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 "Context" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Context)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Context" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Maybe Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Maybe Token
a') ->
      case Int -> ATermTable -> (ATermTable, [PatElem])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: [PatElem]
b') ->
      (ATermTable
att2, Maybe Token -> [PatElem] -> Context
Context Maybe Token
a' [PatElem]
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Context)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Context" ShATerm
u

instance ShATermConvertible Adl.As.PatElem where
  toShATermAux :: ATermTable -> PatElem -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: PatElem
xv = case PatElem
xv of
    Pr a :: RuleHeader
a b :: Rule
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> RuleHeader -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 RuleHeader
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Rule -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Rule
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 "Pr" [Int
a', Int
b'] []) ATermTable
att2
    Pg a :: Concept
a b :: Concept
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Concept -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Concept
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Concept -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Concept
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 "Pg" [Int
a', Int
b'] []) ATermTable
att2
    Pk a :: KeyDef
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> KeyDef -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 KeyDef
a
      (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 "Pk" [Int
a'] []) ATermTable
att1
    Pm a :: [RangedProp]
a b :: Relation
b c :: Bool
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> [RangedProp] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 [RangedProp]
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Relation -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Relation
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Bool -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Bool
c
      (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 "Pm" [Int
a', Int
b', Int
c'] []) ATermTable
att3
    Plug a :: Plugin
a b :: Object
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Plugin -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Plugin
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Object -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Object
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 "Plug" [Int
a', Int
b'] []) ATermTable
att2
    Population a :: Bool
a b :: Relation
b c :: [Pair]
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Bool -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Bool
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Relation -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Relation
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> [Pair] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 [Pair]
c
      (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 "Population" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, PatElem)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Pr" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, RuleHeader)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: RuleHeader
a') ->
      case Int -> ATermTable -> (ATermTable, Rule)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Rule
b') ->
      (ATermTable
att2, RuleHeader -> Rule -> PatElem
Pr RuleHeader
a' Rule
b') }}
    ShAAppl "Pg" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Concept)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Concept
a') ->
      case Int -> ATermTable -> (ATermTable, Concept)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Concept
b') ->
      (ATermTable
att2, Concept -> Concept -> PatElem
Pg Concept
a' Concept
b') }}
    ShAAppl "Pk" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, KeyDef)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: KeyDef
a') ->
      (ATermTable
att1, KeyDef -> PatElem
Pk KeyDef
a') }
    ShAAppl "Pm" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, [RangedProp])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: [RangedProp]
a') ->
      case Int -> ATermTable -> (ATermTable, Relation)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Relation
b') ->
      case Int -> ATermTable -> (ATermTable, Bool)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Bool
c') ->
      (ATermTable
att3, [RangedProp] -> Relation -> Bool -> PatElem
Pm [RangedProp]
a' Relation
b' Bool
c') }}}
    ShAAppl "Plug" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Plugin)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Plugin
a') ->
      case Int -> ATermTable -> (ATermTable, Object)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Object
b') ->
      (ATermTable
att2, Plugin -> Object -> PatElem
Plug Plugin
a' Object
b') }}
    ShAAppl "Population" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, Bool)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Bool
a') ->
      case Int -> ATermTable -> (ATermTable, Relation)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Relation
b') ->
      case Int -> ATermTable -> (ATermTable, [Pair])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: [Pair]
c') ->
      (ATermTable
att3, Bool -> Relation -> [Pair] -> PatElem
Population Bool
a' Relation
b' [Pair]
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, PatElem)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.PatElem" ShATerm
u

instance ShATermConvertible Adl.As.Plugin where
  toShATermAux :: ATermTable -> Plugin -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Plugin
xv = case Plugin
xv of
    Service -> (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 "Service" [] []) ATermTable
att0
    Sqlplug -> (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 "Sqlplug" [] []) ATermTable
att0
    Phpplug -> (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 "Phpplug" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Plugin)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Service" [] _ -> (ATermTable
att0, Plugin
Service)
    ShAAppl "Sqlplug" [] _ -> (ATermTable
att0, Plugin
Sqlplug)
    ShAAppl "Phpplug" [] _ -> (ATermTable
att0, Plugin
Phpplug)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Plugin)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Plugin" ShATerm
u

instance ShATermConvertible Adl.As.Pair where
  toShATermAux :: ATermTable -> Pair -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Pair
xv = case Pair
xv of
    Pair a :: Token
a b :: Token
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Token
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Token
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 "Pair" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Pair)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Pair" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Token
a') ->
      case Int -> ATermTable -> (ATermTable, Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Token
b') ->
      (ATermTable
att2, Token -> Token -> Pair
Pair Token
a' Token
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Pair)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Pair" ShATerm
u

instance ShATermConvertible Adl.As.RuleHeader where
  toShATermAux :: ATermTable -> RuleHeader -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: RuleHeader
xv = case RuleHeader
xv of
    Always -> (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 "Always" [] []) ATermTable
att0
    RuleHeader a :: RuleKind
a b :: Token
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> RuleKind -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 RuleKind
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Token
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 "RuleHeader" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, RuleHeader)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Always" [] _ -> (ATermTable
att0, RuleHeader
Always)
    ShAAppl "RuleHeader" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, RuleKind)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: RuleKind
a') ->
      case Int -> ATermTable -> (ATermTable, Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Token
b') ->
      (ATermTable
att2, RuleKind -> Token -> RuleHeader
RuleHeader RuleKind
a' Token
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, RuleHeader)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.RuleHeader" ShATerm
u

instance ShATermConvertible Adl.As.RuleKind where
  toShATermAux :: ATermTable -> RuleKind -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: RuleKind
xv = case RuleKind
xv of
    SignalOn -> (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 "SignalOn" [] []) ATermTable
att0
    Signals -> (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 "Signals" [] []) ATermTable
att0
    Maintains -> (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 "Maintains" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, RuleKind)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "SignalOn" [] _ -> (ATermTable
att0, RuleKind
SignalOn)
    ShAAppl "Signals" [] _ -> (ATermTable
att0, RuleKind
Signals)
    ShAAppl "Maintains" [] _ -> (ATermTable
att0, RuleKind
Maintains)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, RuleKind)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.RuleKind" ShATerm
u

instance ShATermConvertible Adl.As.KeyDef where
  toShATermAux :: ATermTable -> KeyDef -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: KeyDef
xv = case KeyDef
xv of
    KeyDef a :: Token
a b :: Concept
b c :: [KeyAtt]
c -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Token
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Concept -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Concept
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> [KeyAtt] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 [KeyAtt]
c
      (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 "KeyDef" [Int
a', Int
b', Int
c'] []) ATermTable
att3
  fromShATermAux :: Int -> ATermTable -> (ATermTable, KeyDef)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "KeyDef" [a :: Int
a, b :: Int
b, c :: Int
c] _ ->
      case Int -> ATermTable -> (ATermTable, Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Token
a') ->
      case Int -> ATermTable -> (ATermTable, Concept)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Concept
b') ->
      case Int -> ATermTable -> (ATermTable, [KeyAtt])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: [KeyAtt]
c') ->
      (ATermTable
att3, Token -> Concept -> [KeyAtt] -> KeyDef
KeyDef Token
a' Concept
b' [KeyAtt]
c') }}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, KeyDef)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.KeyDef" ShATerm
u

instance ShATermConvertible Adl.As.KeyAtt where
  toShATermAux :: ATermTable -> KeyAtt -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: KeyAtt
xv = case KeyAtt
xv of
    KeyAtt a :: Maybe Token
a b :: Rule
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Maybe Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Maybe Token
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Rule -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Rule
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 "KeyAtt" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, KeyAtt)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "KeyAtt" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Maybe Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Maybe Token
a') ->
      case Int -> ATermTable -> (ATermTable, Rule)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Rule
b') ->
      (ATermTable
att2, Maybe Token -> Rule -> KeyAtt
KeyAtt Maybe Token
a' Rule
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, KeyAtt)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.KeyAtt" ShATerm
u

instance ShATermConvertible Adl.As.Object where
  toShATermAux :: ATermTable -> Object -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Object
xv = case Object
xv of
    Object a :: Token
a b :: Rule
b c :: [RangedProp]
c d :: [Object]
d -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Token
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Rule -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Rule
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> [RangedProp] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 [RangedProp]
c
      (att4 :: ATermTable
att4, d' :: Int
d') <- ATermTable -> [Object] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att3 [Object]
d
      (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 "Object" [Int
a', Int
b', Int
c', Int
d'] []) ATermTable
att4
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Object)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Object" [a :: Int
a, b :: Int
b, c :: Int
c, d :: Int
d] _ ->
      case Int -> ATermTable -> (ATermTable, Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Token
a') ->
      case Int -> ATermTable -> (ATermTable, Rule)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Rule
b') ->
      case Int -> ATermTable -> (ATermTable, [RangedProp])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: [RangedProp]
c') ->
      case Int -> ATermTable -> (ATermTable, [Object])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
d ATermTable
att3 of
      { (att4 :: ATermTable
att4, d' :: [Object]
d') ->
      (ATermTable
att4, Token -> Rule -> [RangedProp] -> [Object] -> Object
Object Token
a' Rule
b' [RangedProp]
c' [Object]
d') }}}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Object)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Object" ShATerm
u

instance ShATermConvertible Adl.As.RangedProp where
  toShATermAux :: ATermTable -> RangedProp -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: RangedProp
xv = case RangedProp
xv of
    RangedProp a :: Prop
a b :: Range
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Prop -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Prop
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Range
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 "RangedProp" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, RangedProp)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "RangedProp" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Prop)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Prop
a') ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Range
b') ->
      (ATermTable
att2, Prop -> Range -> RangedProp
RangedProp Prop
a' Range
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, RangedProp)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.RangedProp" ShATerm
u

instance ShATermConvertible Adl.As.Prop where
  toShATermAux :: ATermTable -> Prop -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Prop
xv = case Prop
xv of
    Uni -> (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 "Uni" [] []) ATermTable
att0
    Inj -> (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 "Inj" [] []) ATermTable
att0
    Sur -> (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 "Sur" [] []) ATermTable
att0
    Tot -> (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 "Tot" [] []) ATermTable
att0
    Sym -> (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 "Sym" [] []) ATermTable
att0
    Asy -> (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 "Asy" [] []) ATermTable
att0
    Trn -> (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 "Trn" [] []) ATermTable
att0
    Rfx -> (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 "Rfx" [] []) ATermTable
att0
    Prop -> (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 "Prop" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Prop)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Uni" [] _ -> (ATermTable
att0, Prop
Uni)
    ShAAppl "Inj" [] _ -> (ATermTable
att0, Prop
Inj)
    ShAAppl "Sur" [] _ -> (ATermTable
att0, Prop
Sur)
    ShAAppl "Tot" [] _ -> (ATermTable
att0, Prop
Tot)
    ShAAppl "Sym" [] _ -> (ATermTable
att0, Prop
Sym)
    ShAAppl "Asy" [] _ -> (ATermTable
att0, Prop
Asy)
    ShAAppl "Trn" [] _ -> (ATermTable
att0, Prop
Trn)
    ShAAppl "Rfx" [] _ -> (ATermTable
att0, Prop
Rfx)
    ShAAppl "Prop" [] _ -> (ATermTable
att0, Prop
Prop)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Prop)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Prop" ShATerm
u

instance ShATermConvertible Adl.As.Rule where
  toShATermAux :: ATermTable -> Rule -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Rule
xv = case Rule
xv of
    Tm a :: Relation
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Relation -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Relation
a
      (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 "Tm" [Int
a'] []) ATermTable
att1
    MulExp a :: MulOp
a b :: [Rule]
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> MulOp -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 MulOp
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> [Rule] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 [Rule]
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 "MulExp" [Int
a', Int
b'] []) ATermTable
att2
    UnExp a :: UnOp
a b :: Rule
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> UnOp -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 UnOp
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Rule -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Rule
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 "UnExp" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Rule)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Tm" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, Relation)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Relation
a') ->
      (ATermTable
att1, Relation -> Rule
Tm Relation
a') }
    ShAAppl "MulExp" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, MulOp)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: MulOp
a') ->
      case Int -> ATermTable -> (ATermTable, [Rule])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: [Rule]
b') ->
      (ATermTable
att2, MulOp -> [Rule] -> Rule
MulExp MulOp
a' [Rule]
b') }}
    ShAAppl "UnExp" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, UnOp)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: UnOp
a') ->
      case Int -> ATermTable -> (ATermTable, Rule)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Rule
b') ->
      (ATermTable
att2, UnOp -> Rule -> Rule
UnExp UnOp
a' Rule
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Rule)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Rule" ShATerm
u

instance ShATermConvertible Adl.As.MulOp where
  toShATermAux :: ATermTable -> MulOp -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: MulOp
xv = case MulOp
xv of
    Fc -> (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 "Fc" [] []) ATermTable
att0
    Fd -> (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 "Fd" [] []) ATermTable
att0
    Fi -> (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 "Fi" [] []) ATermTable
att0
    Fu -> (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 "Fu" [] []) ATermTable
att0
    Ri -> (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 "Ri" [] []) ATermTable
att0
    Rr -> (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 "Rr" [] []) ATermTable
att0
    Re -> (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 "Re" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, MulOp)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Fc" [] _ -> (ATermTable
att0, MulOp
Fc)
    ShAAppl "Fd" [] _ -> (ATermTable
att0, MulOp
Fd)
    ShAAppl "Fi" [] _ -> (ATermTable
att0, MulOp
Fi)
    ShAAppl "Fu" [] _ -> (ATermTable
att0, MulOp
Fu)
    ShAAppl "Ri" [] _ -> (ATermTable
att0, MulOp
Ri)
    ShAAppl "Rr" [] _ -> (ATermTable
att0, MulOp
Rr)
    ShAAppl "Re" [] _ -> (ATermTable
att0, MulOp
Re)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, MulOp)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.MulOp" ShATerm
u

instance ShATermConvertible Adl.As.UnOp where
  toShATermAux :: ATermTable -> UnOp -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: UnOp
xv = case UnOp
xv of
    K0 -> (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 "K0" [] []) ATermTable
att0
    K1 -> (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 "K1" [] []) ATermTable
att0
    Cp -> (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 "Cp" [] []) ATermTable
att0
    Co -> (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 "Co" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, UnOp)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "K0" [] _ -> (ATermTable
att0, UnOp
K0)
    ShAAppl "K1" [] _ -> (ATermTable
att0, UnOp
K1)
    ShAAppl "Cp" [] _ -> (ATermTable
att0, UnOp
Cp)
    ShAAppl "Co" [] _ -> (ATermTable
att0, UnOp
Co)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, UnOp)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.UnOp" ShATerm
u

instance ShATermConvertible Adl.As.Relation where
  toShATermAux :: ATermTable -> Relation -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Relation
xv = case Relation
xv of
    Sgn a :: Token
a b :: RelType
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Token
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> RelType -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 RelType
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 "Sgn" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Relation)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Sgn" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Token
a') ->
      case Int -> ATermTable -> (ATermTable, RelType)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: RelType
b') ->
      (ATermTable
att2, Token -> RelType -> Relation
Sgn Token
a' RelType
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Relation)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Relation" ShATerm
u

instance ShATermConvertible Adl.As.RelType where
  toShATermAux :: ATermTable -> RelType -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: RelType
xv = case RelType
xv of
    RelType a :: Concept
a b :: Concept
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Concept -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Concept
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Concept -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Concept
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 "RelType" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, RelType)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "RelType" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Concept)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Concept
a') ->
      case Int -> ATermTable -> (ATermTable, Concept)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Concept
b') ->
      (ATermTable
att2, Concept -> Concept -> RelType
RelType Concept
a' Concept
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, RelType)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.RelType" ShATerm
u

instance ShATermConvertible Adl.As.Concept where
  toShATermAux :: ATermTable -> Concept -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Concept
xv = case Concept
xv of
    C a :: Token
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Token -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Token
a
      (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 "C" [Int
a'] []) ATermTable
att1
    Anything -> (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 "Anything" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Concept)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "C" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, Token)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Token
a') ->
      (ATermTable
att1, Token -> Concept
C Token
a') }
    ShAAppl "Anything" [] _ -> (ATermTable
att0, Concept
Anything)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Concept)
forall a. String -> ShATerm -> a
fromShATermError "Adl.As.Concept" ShATerm
u

deriving instance GHC.Generics.Generic Adl.Sign.Sen
instance Data.Aeson.ToJSON Adl.Sign.Sen where
instance Data.Aeson.FromJSON Adl.Sign.Sen where

deriving instance GHC.Generics.Generic Adl.Sign.RawSymbol
instance Data.Aeson.ToJSON Adl.Sign.RawSymbol where
instance Data.Aeson.FromJSON Adl.Sign.RawSymbol where

deriving instance GHC.Generics.Generic Adl.Sign.SymbolKind
instance Data.Aeson.ToJSON Adl.Sign.SymbolKind where
instance Data.Aeson.FromJSON Adl.Sign.SymbolKind where

deriving instance GHC.Generics.Generic Adl.Sign.Symbol
instance Data.Aeson.ToJSON Adl.Sign.Symbol where
instance Data.Aeson.FromJSON Adl.Sign.Symbol where

deriving instance GHC.Generics.Generic Adl.Sign.Sign
instance Data.Aeson.ToJSON Adl.Sign.Sign where
instance Data.Aeson.FromJSON Adl.Sign.Sign where

instance ShATermConvertible Adl.Sign.Sen where
  toShATermAux :: ATermTable -> Sen -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Sen
xv = case Sen
xv of
    DeclProp a :: Relation
a b :: RangedProp
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Relation -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Relation
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> RangedProp -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 RangedProp
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 "DeclProp" [Int
a', Int
b'] []) ATermTable
att2
    Assertion a :: Maybe RuleKind
a b :: Rule
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Maybe RuleKind -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Maybe RuleKind
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Rule -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Rule
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 "Assertion" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Sen)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "DeclProp" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Relation)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Relation
a') ->
      case Int -> ATermTable -> (ATermTable, RangedProp)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: RangedProp
b') ->
      (ATermTable
att2, Relation -> RangedProp -> Sen
DeclProp Relation
a' RangedProp
b') }}
    ShAAppl "Assertion" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, Maybe RuleKind)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Maybe RuleKind
a') ->
      case Int -> ATermTable -> (ATermTable, Rule)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Rule
b') ->
      (ATermTable
att2, Maybe RuleKind -> Rule -> Sen
Assertion Maybe RuleKind
a' Rule
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Sen)
forall a. String -> ShATerm -> a
fromShATermError "Adl.Sign.Sen" ShATerm
u

instance ShATermConvertible Adl.Sign.RawSymbol where
  toShATermAux :: ATermTable -> RawSymbol -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: RawSymbol
xv = case RawSymbol
xv of
    Symbol a :: Symbol
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Symbol -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Symbol
a
      (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 "Symbol" [Int
a'] []) ATermTable
att1
    AnId a :: Id
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Id -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Id
a
      (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 "AnId" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, RawSymbol)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Symbol" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, Symbol)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Symbol
a') ->
      (ATermTable
att1, Symbol -> RawSymbol
Symbol Symbol
a') }
    ShAAppl "AnId" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, Id)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Id
a') ->
      (ATermTable
att1, Id -> RawSymbol
AnId Id
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, RawSymbol)
forall a. String -> ShATerm -> a
fromShATermError "Adl.Sign.RawSymbol" ShATerm
u

instance ShATermConvertible Adl.Sign.SymbolKind where
  toShATermAux :: ATermTable -> SymbolKind -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: SymbolKind
xv = case SymbolKind
xv of
    ConK -> (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 "ConK" [] []) ATermTable
att0
    RelK -> (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 "RelK" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, SymbolKind)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "ConK" [] _ -> (ATermTable
att0, SymbolKind
ConK)
    ShAAppl "RelK" [] _ -> (ATermTable
att0, SymbolKind
RelK)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, SymbolKind)
forall a. String -> ShATerm -> a
fromShATermError "Adl.Sign.SymbolKind" ShATerm
u

instance ShATermConvertible Adl.Sign.Symbol where
  toShATermAux :: ATermTable -> Symbol -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Symbol
xv = case Symbol
xv of
    Con a :: Concept
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Concept -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Concept
a
      (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 "Con" [Int
a'] []) ATermTable
att1
    Rel a :: Relation
a -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Relation -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Relation
a
      (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 "Rel" [Int
a'] []) ATermTable
att1
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Symbol)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Con" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, Concept)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Concept
a') ->
      (ATermTable
att1, Concept -> Symbol
Con Concept
a') }
    ShAAppl "Rel" [a :: Int
a] _ ->
      case Int -> ATermTable -> (ATermTable, Relation)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Relation
a') ->
      (ATermTable
att1, Relation -> Symbol
Rel Relation
a') }
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Symbol)
forall a. String -> ShATerm -> a
fromShATermError "Adl.Sign.Symbol" ShATerm
u

instance ShATermConvertible Adl.Sign.Sign where
  toShATermAux :: ATermTable -> Sign -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: Sign
xv = case Sign
xv of
    Sign a :: RelMap
a b :: Rel Concept
b -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> RelMap -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 RelMap
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Rel Concept -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Rel Concept
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 "Sign" [Int
a', Int
b'] []) ATermTable
att2
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Sign)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "Sign" [a :: Int
a, b :: Int
b] _ ->
      case Int -> ATermTable -> (ATermTable, RelMap)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: RelMap
a') ->
      case Int -> ATermTable -> (ATermTable, Rel Concept)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Rel Concept
b') ->
      (ATermTable
att2, RelMap -> Rel Concept -> Sign
Sign RelMap
a' Rel Concept
b') }}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, Sign)
forall a. String -> ShATerm -> a
fromShATermError "Adl.Sign.Sign" ShATerm
u