{-# OPTIONS -w -O0 #-}
{-# LANGUAGE CPP, StandaloneDeriving, DeriveDataTypeable, DeriveGeneric #-}
{- |
Module      :  ATC/DefaultMorphism.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):
'Common.DefaultMorphism.DefaultMorphism'
-}

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

module ATC.DefaultMorphism () where

import ATerm.Lib
import Common.DefaultMorphism
import Common.Doc
import Common.DocUtils
import Common.Json.Instances
import Common.Keywords
import Data.Aeson(ToJSON, FromJSON)
import Data.Data
import GHC.Generics(Generic)

{-! for Common.DefaultMorphism.DefaultMorphism derive : ShATermConvertible !-}

{-! for Common.DefaultMorphism.DefaultMorphism derive : Json !-}

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

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

deriving instance GHC.Generics.Generic (Common.DefaultMorphism.DefaultMorphism sign)
instance Data.Aeson.ToJSON sign => Data.Aeson.ToJSON (Common.DefaultMorphism.DefaultMorphism sign) where
instance Data.Aeson.FromJSON sign => Data.Aeson.FromJSON (Common.DefaultMorphism.DefaultMorphism sign) where