{-# OPTIONS -w -O0 #-}
{- |
Module      :  CspCASL/ATC_CspCASL.der.hs
Description :  generated Typeable, ShATermConvertible instances
Copyright   :  (c) DFKI Bremen 2008
License     :  GPLv2 or higher, see LICENSE.txt

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

Automatic derivation of instances via DrIFT-rule Typeable, ShATermConvertible
  for the type(s):
'CspCASL.AS_CspCASL.CspBasicExt'
'CspCASL.AS_CspCASL.CHANNEL_DECL'
'CspCASL.AS_CspCASL.PROC_ITEM'
'CspCASL.AS_CspCASL.PARM_PROCNAME'
'CspCASL.AS_CspCASL_Process.EVENT'
'CspCASL.AS_CspCASL_Process.EVENT_SET'
'CspCASL.AS_CspCASL_Process.RenameKind'
'CspCASL.AS_CspCASL_Process.Rename'
'CspCASL.AS_CspCASL_Process.RENAMING'
'CspCASL.AS_CspCASL_Process.PROC_ALPHABET'
'CspCASL.AS_CspCASL_Process.ProcProfile'
'CspCASL.AS_CspCASL_Process.FQ_PROCESS_NAME'
'CspCASL.AS_CspCASL_Process.TypedChanName'
'CspCASL.AS_CspCASL_Process.CommType'
'CspCASL.AS_CspCASL_Process.PROCESS'
'CspCASL.SignCSP.CspSign'
'CspCASL.SignCSP.CspSen'
'CspCASL.SymbItems.CspSymbItems'
'CspCASL.SymbItems.CspSymbMapItems'
'CspCASL.SymbItems.CspSymbKind'
'CspCASL.SymbItems.CspSymb'
'CspCASL.SymbItems.CspType'
'CspCASL.SymbItems.CspSymbMap'
'CspCASL.Symbol.CspSymbType'
'CspCASL.Symbol.CspSymbol'
'CspCASL.Symbol.CspRawSymbol'
'CspCASL.Morphism.CspAddMorphism'
-}

{-
  Generated by 'genRules' (automatic rule generation for DrIFT). Don't touch!!
  dependency files:
CspCASL/AS_CspCASL.hs
CspCASL/AS_CspCASL_Process.hs
CspCASL/SignCSP.hs
CspCASL/SymbItems.hs
CspCASL/Symbol.hs
CspCASL/Morphism.hs
-}

module CspCASL.ATC_CspCASL () where

import ATerm.Lib
import CASL.AS_Basic_CASL
import CASL.AS_Basic_CASL (FORMULA, SORT, TERM (..), VAR)
import CASL.AS_Basic_CASL (FORMULA, TERM, SORT, SORT_ITEM (..), OpKind (..))
import CASL.AS_Basic_CASL (SORT, VAR, VAR_DECL)
import CASL.ATC_CASL
import CASL.Morphism
import CASL.Morphism as CASL_Morphism
import CASL.Overload
import CASL.Sign
import CASL.Sign as CASL_Sign
import CASL.SymbolParser
import CASL.ToDoc
import Common.AS_Annotation (Annoted)
import Common.AnnoState
import Common.Doc
import Common.Doc hiding (braces)
import Common.DocUtils
import Common.Id
import Common.Keywords
import Common.Lexer
import Common.Lib.Rel (Rel, predecessors, member)
import Common.Parsec
import Common.Result
import Common.Token
import Common.Utils (composeMap)
import Common.Utils (keepMins)
import Control.Monad
import CspCASL.AS_CspCASL
import CspCASL.AS_CspCASL ()
import CspCASL.AS_CspCASL_Process
import CspCASL.CspCASL_Keywords
import CspCASL.Morphism
import CspCASL.Parse_CspCASL_Process
import CspCASL.Print_CspCASL
import CspCASL.Print_CspCASL ()
import CspCASL.SignCSP
import CspCASL.SymbItems
import CspCASL.Symbol
import Data.List
import Data.Ord
import Data.Typeable
import Text.ParserCombinators.Parsec
import qualified CASL.MapSentence as CASL_MapSen
import qualified Common.Lib.MapSet as MapSet
import qualified Common.Lib.Rel as Rel
import qualified CspCASL.LocalTop as LT
import qualified CspCASL.LocalTop as LocalTop
import qualified Data.Map as Map
import qualified Data.Set as Set

{-! for CspCASL.AS_CspCASL.CspBasicExt derive : Typeable !-}
{-! for CspCASL.AS_CspCASL.CHANNEL_DECL derive : Typeable !-}
{-! for CspCASL.AS_CspCASL.PROC_ITEM derive : Typeable !-}
{-! for CspCASL.AS_CspCASL.PARM_PROCNAME derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.EVENT derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.EVENT_SET derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.RenameKind derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.Rename derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.RENAMING derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.PROC_ALPHABET derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.ProcProfile derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.FQ_PROCESS_NAME derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.TypedChanName derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.CommType derive : Typeable !-}
{-! for CspCASL.AS_CspCASL_Process.PROCESS derive : Typeable !-}
{-! for CspCASL.SignCSP.CspSign derive : Typeable !-}
{-! for CspCASL.SignCSP.CspSen derive : Typeable !-}
{-! for CspCASL.SymbItems.CspSymbItems derive : Typeable !-}
{-! for CspCASL.SymbItems.CspSymbMapItems derive : Typeable !-}
{-! for CspCASL.SymbItems.CspSymbKind derive : Typeable !-}
{-! for CspCASL.SymbItems.CspSymb derive : Typeable !-}
{-! for CspCASL.SymbItems.CspType derive : Typeable !-}
{-! for CspCASL.SymbItems.CspSymbMap derive : Typeable !-}
{-! for CspCASL.Symbol.CspSymbType derive : Typeable !-}
{-! for CspCASL.Symbol.CspSymbol derive : Typeable !-}
{-! for CspCASL.Symbol.CspRawSymbol derive : Typeable !-}
{-! for CspCASL.Morphism.CspAddMorphism derive : Typeable !-}

{-! for CspCASL.AS_CspCASL.CspBasicExt derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL.CHANNEL_DECL derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL.PROC_ITEM derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL.PARM_PROCNAME derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.EVENT derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.EVENT_SET derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.RenameKind derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.Rename derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.RENAMING derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.PROC_ALPHABET derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.ProcProfile derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.FQ_PROCESS_NAME derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.TypedChanName derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.CommType derive : ShATermConvertible !-}
{-! for CspCASL.AS_CspCASL_Process.PROCESS derive : ShATermConvertible !-}
{-! for CspCASL.SignCSP.CspSign derive : ShATermConvertible !-}
{-! for CspCASL.SignCSP.CspSen derive : ShATermConvertible !-}
{-! for CspCASL.SymbItems.CspSymbItems derive : ShATermConvertible !-}
{-! for CspCASL.SymbItems.CspSymbMapItems derive : ShATermConvertible !-}
{-! for CspCASL.SymbItems.CspSymbKind derive : ShATermConvertible !-}
{-! for CspCASL.SymbItems.CspSymb derive : ShATermConvertible !-}
{-! for CspCASL.SymbItems.CspType derive : ShATermConvertible !-}
{-! for CspCASL.SymbItems.CspSymbMap derive : ShATermConvertible !-}
{-! for CspCASL.Symbol.CspSymbType derive : ShATermConvertible !-}
{-! for CspCASL.Symbol.CspSymbol derive : ShATermConvertible !-}
{-! for CspCASL.Symbol.CspRawSymbol derive : ShATermConvertible !-}
{-! for CspCASL.Morphism.CspAddMorphism derive : ShATermConvertible !-}

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

_tcCspBasicExtTc :: TyCon
_tcCspBasicExtTc = mkTyCon "CspCASL.AS_CspCASL.CspBasicExt"
instance Typeable CspBasicExt where
    typeOf _ = mkTyConApp _tcCspBasicExtTc []

_tcCHANNEL_DECLTc :: TyCon
_tcCHANNEL_DECLTc = mkTyCon "CspCASL.AS_CspCASL.CHANNEL_DECL"
instance Typeable CHANNEL_DECL where
    typeOf _ = mkTyConApp _tcCHANNEL_DECLTc []

_tcPROC_ITEMTc :: TyCon
_tcPROC_ITEMTc = mkTyCon "CspCASL.AS_CspCASL.PROC_ITEM"
instance Typeable PROC_ITEM where
    typeOf _ = mkTyConApp _tcPROC_ITEMTc []

_tcPARM_PROCNAMETc :: TyCon
_tcPARM_PROCNAMETc = mkTyCon "CspCASL.AS_CspCASL.PARM_PROCNAME"
instance Typeable PARM_PROCNAME where
    typeOf _ = mkTyConApp _tcPARM_PROCNAMETc []

instance ShATermConvertible CspBasicExt where
  toShATermAux att0 xv = case xv of
    Channels a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "Channels" [a', b'] []) att2
    ProcItems a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "ProcItems" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "Channels" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, Channels a' b') }}
    ShAAppl "ProcItems" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, ProcItems a' b') }}
    u -> fromShATermError "CspBasicExt" u

instance ShATermConvertible CHANNEL_DECL where
  toShATermAux att0 xv = case xv of
    ChannelDecl a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "ChannelDecl" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "ChannelDecl" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, ChannelDecl a' b') }}
    u -> fromShATermError "CHANNEL_DECL" u

instance ShATermConvertible PROC_ITEM where
  toShATermAux att0 xv = case xv of
    Proc_Decl a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "Proc_Decl" [a', b', c'] []) att3
    Proc_Defn a b c d -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      (att4, d') <- toShATerm' att3 d
      return $ addATerm (ShAAppl "Proc_Defn" [a', b', c', d'] []) att4
    Proc_Eq a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "Proc_Eq" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "Proc_Decl" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, Proc_Decl a' b' c') }}}
    ShAAppl "Proc_Defn" [a, b, c, d] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      case fromShATerm' d att3 of
      { (att4, d') ->
      (att4, Proc_Defn a' b' c' d') }}}}
    ShAAppl "Proc_Eq" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, Proc_Eq a' b') }}
    u -> fromShATermError "PROC_ITEM" u

instance ShATermConvertible PARM_PROCNAME where
  toShATermAux att0 xv = case xv of
    ParmProcname a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "ParmProcname" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "ParmProcname" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, ParmProcname a' b') }}
    u -> fromShATermError "PARM_PROCNAME" u

_tcEVENTTc :: TyCon
_tcEVENTTc = mkTyCon "CspCASL.AS_CspCASL_Process.EVENT"
instance Typeable EVENT where
    typeOf _ = mkTyConApp _tcEVENTTc []

_tcEVENT_SETTc :: TyCon
_tcEVENT_SETTc = mkTyCon "CspCASL.AS_CspCASL_Process.EVENT_SET"
instance Typeable EVENT_SET where
    typeOf _ = mkTyConApp _tcEVENT_SETTc []

_tcRenameKindTc :: TyCon
_tcRenameKindTc = mkTyCon "CspCASL.AS_CspCASL_Process.RenameKind"
instance Typeable RenameKind where
    typeOf _ = mkTyConApp _tcRenameKindTc []

_tcRenameTc :: TyCon
_tcRenameTc = mkTyCon "CspCASL.AS_CspCASL_Process.Rename"
instance Typeable Rename where
    typeOf _ = mkTyConApp _tcRenameTc []

_tcRENAMINGTc :: TyCon
_tcRENAMINGTc = mkTyCon "CspCASL.AS_CspCASL_Process.RENAMING"
instance Typeable RENAMING where
    typeOf _ = mkTyConApp _tcRENAMINGTc []

_tcPROC_ALPHABETTc :: TyCon
_tcPROC_ALPHABETTc = mkTyCon "CspCASL.AS_CspCASL_Process.PROC_ALPHABET"
instance Typeable PROC_ALPHABET where
    typeOf _ = mkTyConApp _tcPROC_ALPHABETTc []

_tcProcProfileTc :: TyCon
_tcProcProfileTc = mkTyCon "CspCASL.AS_CspCASL_Process.ProcProfile"
instance Typeable ProcProfile where
    typeOf _ = mkTyConApp _tcProcProfileTc []

_tcFQ_PROCESS_NAMETc :: TyCon
_tcFQ_PROCESS_NAMETc = mkTyCon "CspCASL.AS_CspCASL_Process.FQ_PROCESS_NAME"
instance Typeable FQ_PROCESS_NAME where
    typeOf _ = mkTyConApp _tcFQ_PROCESS_NAMETc []

_tcTypedChanNameTc :: TyCon
_tcTypedChanNameTc = mkTyCon "CspCASL.AS_CspCASL_Process.TypedChanName"
instance Typeable TypedChanName where
    typeOf _ = mkTyConApp _tcTypedChanNameTc []

_tcCommTypeTc :: TyCon
_tcCommTypeTc = mkTyCon "CspCASL.AS_CspCASL_Process.CommType"
instance Typeable CommType where
    typeOf _ = mkTyConApp _tcCommTypeTc []

_tcPROCESSTc :: TyCon
_tcPROCESSTc = mkTyCon "CspCASL.AS_CspCASL_Process.PROCESS"
instance Typeable PROCESS where
    typeOf _ = mkTyConApp _tcPROCESSTc []

instance ShATermConvertible EVENT where
  toShATermAux att0 xv = case xv of
    TermEvent a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "TermEvent" [a', b'] []) att2
    ExternalPrefixChoice a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "ExternalPrefixChoice" [a', b',
                                                         c'] []) att3
    InternalPrefixChoice a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "InternalPrefixChoice" [a', b',
                                                         c'] []) att3
    ChanSend a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "ChanSend" [a', b', c'] []) att3
    ChanNonDetSend a b c d -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      (att4, d') <- toShATerm' att3 d
      return $ addATerm (ShAAppl "ChanNonDetSend" [a', b', c',
                                                   d'] []) att4
    ChanRecv a b c d -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      (att4, d') <- toShATerm' att3 d
      return $ addATerm (ShAAppl "ChanRecv" [a', b', c', d'] []) att4
    FQTermEvent a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "FQTermEvent" [a', b'] []) att2
    FQExternalPrefixChoice a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "FQExternalPrefixChoice" [a',
                                                           b'] []) att2
    FQInternalPrefixChoice a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "FQInternalPrefixChoice" [a',
                                                           b'] []) att2
    FQChanSend a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "FQChanSend" [a', b', c'] []) att3
    FQChanNonDetSend a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "FQChanNonDetSend" [a', b', c'] []) att3
    FQChanRecv a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "FQChanRecv" [a', b', c'] []) att3
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "TermEvent" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, TermEvent a' b') }}
    ShAAppl "ExternalPrefixChoice" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, ExternalPrefixChoice a' b' c') }}}
    ShAAppl "InternalPrefixChoice" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, InternalPrefixChoice a' b' c') }}}
    ShAAppl "ChanSend" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, ChanSend a' b' c') }}}
    ShAAppl "ChanNonDetSend" [a, b, c, d] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      case fromShATerm' d att3 of
      { (att4, d') ->
      (att4, ChanNonDetSend a' b' c' d') }}}}
    ShAAppl "ChanRecv" [a, b, c, d] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      case fromShATerm' d att3 of
      { (att4, d') ->
      (att4, ChanRecv a' b' c' d') }}}}
    ShAAppl "FQTermEvent" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, FQTermEvent a' b') }}
    ShAAppl "FQExternalPrefixChoice" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, FQExternalPrefixChoice a' b') }}
    ShAAppl "FQInternalPrefixChoice" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, FQInternalPrefixChoice a' b') }}
    ShAAppl "FQChanSend" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, FQChanSend a' b' c') }}}
    ShAAppl "FQChanNonDetSend" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, FQChanNonDetSend a' b' c') }}}
    ShAAppl "FQChanRecv" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, FQChanRecv a' b' c') }}}
    u -> fromShATermError "EVENT" u

instance ShATermConvertible EVENT_SET where
  toShATermAux att0 xv = case xv of
    EventSet a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "EventSet" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "EventSet" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, EventSet a' b') }}
    u -> fromShATermError "EVENT_SET" u

instance ShATermConvertible RenameKind where
  toShATermAux att0 xv = case xv of
    TotOp -> return $ addATerm (ShAAppl "TotOp" [] []) att0
    PartOp -> return $ addATerm (ShAAppl "PartOp" [] []) att0
    BinPred -> return $ addATerm (ShAAppl "BinPred" [] []) att0
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "TotOp" [] _ -> (att0, TotOp)
    ShAAppl "PartOp" [] _ -> (att0, PartOp)
    ShAAppl "BinPred" [] _ -> (att0, BinPred)
    u -> fromShATermError "RenameKind" u

instance ShATermConvertible Rename where
  toShATermAux att0 xv = case xv of
    Rename a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "Rename" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "Rename" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, Rename a' b') }}
    u -> fromShATermError "Rename" u

instance ShATermConvertible RENAMING where
  toShATermAux att0 xv = case xv of
    Renaming a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "Renaming" [a'] []) att1
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "Renaming" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, Renaming a') }
    u -> fromShATermError "RENAMING" u

instance ShATermConvertible PROC_ALPHABET where
  toShATermAux att0 xv = case xv of
    ProcAlphabet a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "ProcAlphabet" [a'] []) att1
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "ProcAlphabet" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, ProcAlphabet a') }
    u -> fromShATermError "PROC_ALPHABET" u

instance ShATermConvertible ProcProfile where
  toShATermAux att0 xv = case xv of
    ProcProfile a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "ProcProfile" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "ProcProfile" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, ProcProfile a' b') }}
    u -> fromShATermError "ProcProfile" u

instance ShATermConvertible FQ_PROCESS_NAME where
  toShATermAux att0 xv = case xv of
    PROCESS_NAME a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "PROCESS_NAME" [a'] []) att1
    FQ_PROCESS_NAME a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "FQ_PROCESS_NAME" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "PROCESS_NAME" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, PROCESS_NAME a') }
    ShAAppl "FQ_PROCESS_NAME" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, FQ_PROCESS_NAME a' b') }}
    u -> fromShATermError "FQ_PROCESS_NAME" u

instance ShATermConvertible TypedChanName where
  toShATermAux att0 xv = case xv of
    TypedChanName a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "TypedChanName" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "TypedChanName" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, TypedChanName a' b') }}
    u -> fromShATermError "TypedChanName" u

instance ShATermConvertible CommType where
  toShATermAux att0 xv = case xv of
    CommTypeSort a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "CommTypeSort" [a'] []) att1
    CommTypeChan a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "CommTypeChan" [a'] []) att1
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CommTypeSort" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, CommTypeSort a') }
    ShAAppl "CommTypeChan" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, CommTypeChan a') }
    u -> fromShATermError "CommType" u

instance ShATermConvertible PROCESS where
  toShATermAux att0 xv = case xv of
    Skip a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "Skip" [a'] []) att1
    Stop a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "Stop" [a'] []) att1
    Div a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "Div" [a'] []) att1
    Run a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "Run" [a', b'] []) att2
    Chaos a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "Chaos" [a', b'] []) att2
    PrefixProcess a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "PrefixProcess" [a', b', c'] []) att3
    Sequential a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "Sequential" [a', b', c'] []) att3
    ExternalChoice a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "ExternalChoice" [a', b', c'] []) att3
    InternalChoice a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "InternalChoice" [a', b', c'] []) att3
    Interleaving a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "Interleaving" [a', b', c'] []) att3
    SynchronousParallel a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "SynchronousParallel" [a', b',
                                                        c'] []) att3
    GeneralisedParallel a b c d -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      (att4, d') <- toShATerm' att3 d
      return $ addATerm (ShAAppl "GeneralisedParallel" [a', b', c',
                                                        d'] []) att4
    AlphabetisedParallel a b c d e -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      (att4, d') <- toShATerm' att3 d
      (att5, e') <- toShATerm' att4 e
      return $ addATerm (ShAAppl "AlphabetisedParallel" [a', b', c', d',
                                                         e'] []) att5
    Hiding a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "Hiding" [a', b', c'] []) att3
    RenamingProcess a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "RenamingProcess" [a', b', c'] []) att3
    ConditionalProcess a b c d -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      (att4, d') <- toShATerm' att3 d
      return $ addATerm (ShAAppl "ConditionalProcess" [a', b', c',
                                                       d'] []) att4
    NamedProcess a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "NamedProcess" [a', b', c'] []) att3
    FQProcess a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "FQProcess" [a', b', c'] []) att3
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "Skip" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, Skip a') }
    ShAAppl "Stop" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, Stop a') }
    ShAAppl "Div" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, Div a') }
    ShAAppl "Run" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, Run a' b') }}
    ShAAppl "Chaos" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, Chaos a' b') }}
    ShAAppl "PrefixProcess" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, PrefixProcess a' b' c') }}}
    ShAAppl "Sequential" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, Sequential a' b' c') }}}
    ShAAppl "ExternalChoice" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, ExternalChoice a' b' c') }}}
    ShAAppl "InternalChoice" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, InternalChoice a' b' c') }}}
    ShAAppl "Interleaving" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, Interleaving a' b' c') }}}
    ShAAppl "SynchronousParallel" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, SynchronousParallel a' b' c') }}}
    ShAAppl "GeneralisedParallel" [a, b, c, d] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      case fromShATerm' d att3 of
      { (att4, d') ->
      (att4, GeneralisedParallel a' b' c' d') }}}}
    ShAAppl "AlphabetisedParallel" [a, b, c, d, e] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      case fromShATerm' d att3 of
      { (att4, d') ->
      case fromShATerm' e att4 of
      { (att5, e') ->
      (att5, AlphabetisedParallel a' b' c' d' e') }}}}}
    ShAAppl "Hiding" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, Hiding a' b' c') }}}
    ShAAppl "RenamingProcess" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, RenamingProcess a' b' c') }}}
    ShAAppl "ConditionalProcess" [a, b, c, d] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      case fromShATerm' d att3 of
      { (att4, d') ->
      (att4, ConditionalProcess a' b' c' d') }}}}
    ShAAppl "NamedProcess" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, NamedProcess a' b' c') }}}
    ShAAppl "FQProcess" [a, b, c] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      (att3, FQProcess a' b' c') }}}
    u -> fromShATermError "PROCESS" u

_tcCspAddMorphismTc :: TyCon
_tcCspAddMorphismTc = mkTyCon "CspCASL.Morphism.CspAddMorphism"
instance Typeable CspAddMorphism where
    typeOf _ = mkTyConApp _tcCspAddMorphismTc []

instance ShATermConvertible CspAddMorphism where
  toShATermAux att0 xv = case xv of
    CspAddMorphism a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspAddMorphism" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CspAddMorphism" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspAddMorphism a' b') }}
    u -> fromShATermError "CspAddMorphism" u

_tcCspSignTc :: TyCon
_tcCspSignTc = mkTyCon "CspCASL.SignCSP.CspSign"
instance Typeable CspSign where
    typeOf _ = mkTyConApp _tcCspSignTc []

_tcCspSenTc :: TyCon
_tcCspSenTc = mkTyCon "CspCASL.SignCSP.CspSen"
instance Typeable CspSen where
    typeOf _ = mkTyConApp _tcCspSenTc []

instance ShATermConvertible CspSign where
  toShATermAux att0 xv = case xv of
    CspSign a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspSign" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CspSign" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspSign a' b') }}
    u -> fromShATermError "CspSign" u

instance ShATermConvertible CspSen where
  toShATermAux att0 xv = case xv of
    ProcessEq a b c d -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      (att4, d') <- toShATerm' att3 d
      return $ addATerm (ShAAppl "ProcessEq" [a', b', c', d'] []) att4
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "ProcessEq" [a, b, c, d] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      case fromShATerm' c att2 of
      { (att3, c') ->
      case fromShATerm' d att3 of
      { (att4, d') ->
      (att4, ProcessEq a' b' c' d') }}}}
    u -> fromShATermError "CspSen" u

instance ShATermConvertible CspSymbMap where
  toShATermAux att0 xv = case xv of
    CspSymbMap a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspSymbMap" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CspSymbMap" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspSymbMap a' b') }}
    u -> fromShATermError "CspSymbMap" u

instance ShATermConvertible CspType where
  toShATermAux att0 xv = case xv of
    CaslType a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "CaslType" [a'] []) att1
    ProcType a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "ProcType" [a'] []) att1
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CaslType" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, CaslType a') }
    ShAAppl "ProcType" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, ProcType a') }
    u -> fromShATermError "CspType" u

instance ShATermConvertible CspSymb where
  toShATermAux att0 xv = case xv of
    CspSymb a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspSymb" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CspSymb" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspSymb a' b') }}
    u -> fromShATermError "CspSymb" u

instance ShATermConvertible CspSymbKind where
  toShATermAux att0 xv = case xv of
    CaslKind a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "CaslKind" [a'] []) att1
    ProcessKind -> return $ addATerm (ShAAppl "ProcessKind" [] []) att0
    ChannelKind -> return $ addATerm (ShAAppl "ChannelKind" [] []) att0
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CaslKind" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, CaslKind a') }
    ShAAppl "ProcessKind" [] _ -> (att0, ProcessKind)
    ShAAppl "ChannelKind" [] _ -> (att0, ChannelKind)
    u -> fromShATermError "CspSymbKind" u

instance ShATermConvertible CspSymbMapItems where
  toShATermAux att0 xv = case xv of
    CspSymbMapItems a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspSymbMapItems" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CspSymbMapItems" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspSymbMapItems a' b') }}
    u -> fromShATermError "CspSymbMapItems" u

instance ShATermConvertible CspSymbItems where
  toShATermAux att0 xv = case xv of
    CspSymbItems a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspSymbItems" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CspSymbItems" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspSymbItems a' b') }}
    u -> fromShATermError "CspSymbItems" u

_tcCspSymbMapTc :: TyCon
_tcCspSymbMapTc = mkTyCon "CspCASL.SymbItems.CspSymbMap"
instance Typeable CspSymbMap where
    typeOf _ = mkTyConApp _tcCspSymbMapTc []

_tcCspTypeTc :: TyCon
_tcCspTypeTc = mkTyCon "CspCASL.SymbItems.CspType"
instance Typeable CspType where
    typeOf _ = mkTyConApp _tcCspTypeTc []

_tcCspSymbTc :: TyCon
_tcCspSymbTc = mkTyCon "CspCASL.SymbItems.CspSymb"
instance Typeable CspSymb where
    typeOf _ = mkTyConApp _tcCspSymbTc []

_tcCspSymbKindTc :: TyCon
_tcCspSymbKindTc = mkTyCon "CspCASL.SymbItems.CspSymbKind"
instance Typeable CspSymbKind where
    typeOf _ = mkTyConApp _tcCspSymbKindTc []

_tcCspSymbMapItemsTc :: TyCon
_tcCspSymbMapItemsTc = mkTyCon "CspCASL.SymbItems.CspSymbMapItems"
instance Typeable CspSymbMapItems where
    typeOf _ = mkTyConApp _tcCspSymbMapItemsTc []

_tcCspSymbItemsTc :: TyCon
_tcCspSymbItemsTc = mkTyCon "CspCASL.SymbItems.CspSymbItems"
instance Typeable CspSymbItems where
    typeOf _ = mkTyConApp _tcCspSymbItemsTc []

_tcCspSymbTypeTc :: TyCon
_tcCspSymbTypeTc = mkTyCon "CspCASL.Symbol.CspSymbType"
instance Typeable CspSymbType where
    typeOf _ = mkTyConApp _tcCspSymbTypeTc []

_tcCspSymbolTc :: TyCon
_tcCspSymbolTc = mkTyCon "CspCASL.Symbol.CspSymbol"
instance Typeable CspSymbol where
    typeOf _ = mkTyConApp _tcCspSymbolTc []

_tcCspRawSymbolTc :: TyCon
_tcCspRawSymbolTc = mkTyCon "CspCASL.Symbol.CspRawSymbol"
instance Typeable CspRawSymbol where
    typeOf _ = mkTyConApp _tcCspRawSymbolTc []

instance ShATermConvertible CspSymbType where
  toShATermAux att0 xv = case xv of
    CaslSymbType a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "CaslSymbType" [a'] []) att1
    ProcAsItemType a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "ProcAsItemType" [a'] []) att1
    ChanAsItemType a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "ChanAsItemType" [a'] []) att1
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CaslSymbType" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, CaslSymbType a') }
    ShAAppl "ProcAsItemType" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, ProcAsItemType a') }
    ShAAppl "ChanAsItemType" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, ChanAsItemType a') }
    u -> fromShATermError "CspSymbType" u

instance ShATermConvertible CspSymbol where
  toShATermAux att0 xv = case xv of
    CspSymbol a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspSymbol" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "CspSymbol" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspSymbol a' b') }}
    u -> fromShATermError "CspSymbol" u

instance ShATermConvertible CspRawSymbol where
  toShATermAux att0 xv = case xv of
    ACspSymbol a -> do
      (att1, a') <- toShATerm' att0 a
      return $ addATerm (ShAAppl "ACspSymbol" [a'] []) att1
    CspKindedSymb a b -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      return $ addATerm (ShAAppl "CspKindedSymb" [a', b'] []) att2
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "ACspSymbol" [a] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      (att1, ACspSymbol a') }
    ShAAppl "CspKindedSymb" [a, b] _ ->
      case fromShATerm' a att0 of
      { (att1, a') ->
      case fromShATerm' b att1 of
      { (att2, b') ->
      (att2, CspKindedSymb a' b') }}
    u -> fromShATermError "CspRawSymbol" u
