{-# OPTIONS -w -O0 #-}
{- |
Module      :  ATC/GlobalAnnotations.der.hs
Description :  generated ShATermConvertible 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
  for the type(s):
'Common.GlobalAnnotations.GlobalAnnos'
'Common.GlobalAnnotations.LiteralAnnos'
'Common.GlobalAnnotations.LiteralType'
-}

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

module ATC.GlobalAnnotations () where

import ATC.AS_Annotation
import ATC.Result
import ATerm.Lib
import Common.AS_Annotation
import Common.GlobalAnnotations
import Common.IRI (IRI)
import Common.Id
import Data.Data
import qualified Common.Lib.Rel as Rel
import qualified Data.Map as Map

{-! for Common.GlobalAnnotations.GlobalAnnos derive : ShATermConvertible !-}
{-! for Common.GlobalAnnotations.LiteralAnnos derive : ShATermConvertible !-}
{-! for Common.GlobalAnnotations.LiteralType derive : ShATermConvertible !-}

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

instance ShATermConvertible GlobalAnnos where
  toShATermAux :: ATermTable -> GlobalAnnos -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: GlobalAnnos
xv = case GlobalAnnos
xv of
    GA a :: PrecedenceGraph
a b :: AssocMap
b c :: DisplayMap
c d :: LiteralAnnos
d e :: LiteralMap
e f :: PrefixMap
f -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> PrecedenceGraph -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 PrecedenceGraph
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> AssocMap -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 AssocMap
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> DisplayMap -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 DisplayMap
c
      (att4 :: ATermTable
att4, d' :: Int
d') <- ATermTable -> LiteralAnnos -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att3 LiteralAnnos
d
      (att5 :: ATermTable
att5, e' :: Int
e') <- ATermTable -> LiteralMap -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att4 LiteralMap
e
      (att6 :: ATermTable
att6, f' :: Int
f') <- ATermTable -> PrefixMap -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att5 PrefixMap
f
      (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 "GA" [Int
a', Int
b', Int
c', Int
d', Int
e', Int
f'] []) ATermTable
att6
  fromShATermAux :: Int -> ATermTable -> (ATermTable, GlobalAnnos)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "GA" [a :: Int
a, b :: Int
b, c :: Int
c, d :: Int
d, e :: Int
e, f :: Int
f] _ ->
      case Int -> ATermTable -> (ATermTable, PrecedenceGraph)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: PrecedenceGraph
a') ->
      case Int -> ATermTable -> (ATermTable, AssocMap)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: AssocMap
b') ->
      case Int -> ATermTable -> (ATermTable, DisplayMap)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: DisplayMap
c') ->
      case Int -> ATermTable -> (ATermTable, LiteralAnnos)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
d ATermTable
att3 of
      { (att4 :: ATermTable
att4, d' :: LiteralAnnos
d') ->
      case Int -> ATermTable -> (ATermTable, LiteralMap)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
e ATermTable
att4 of
      { (att5 :: ATermTable
att5, e' :: LiteralMap
e') ->
      case Int -> ATermTable -> (ATermTable, PrefixMap)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
f ATermTable
att5 of
      { (att6 :: ATermTable
att6, f' :: PrefixMap
f') ->
      (ATermTable
att6, PrecedenceGraph
-> AssocMap
-> DisplayMap
-> LiteralAnnos
-> LiteralMap
-> PrefixMap
-> GlobalAnnos
GA PrecedenceGraph
a' AssocMap
b' DisplayMap
c' LiteralAnnos
d' LiteralMap
e' PrefixMap
f') }}}}}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, GlobalAnnos)
forall a. String -> ShATerm -> a
fromShATermError "GlobalAnnos" ShATerm
u

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

instance ShATermConvertible LiteralType where
  toShATermAux :: ATermTable -> LiteralType -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: LiteralType
xv = case LiteralType
xv of
    StringCons 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 "StringCons" [Int
a'] []) ATermTable
att1
    StringNull -> (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 "StringNull" [] []) ATermTable
att0
    ListCons a :: Id
a b :: Id
b -> 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
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> Id -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 Id
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 "ListCons" [Int
a', Int
b'] []) ATermTable
att2
    ListNull 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 "ListNull" [Int
a'] []) ATermTable
att1
    Number -> (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 "Number" [] []) ATermTable
att0
    Fraction -> (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 "Fraction" [] []) ATermTable
att0
    Floating -> (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 "Floating" [] []) ATermTable
att0
    NoLiteral -> (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 "NoLiteral" [] []) ATermTable
att0
  fromShATermAux :: Int -> ATermTable -> (ATermTable, LiteralType)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "StringCons" [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 -> LiteralType
StringCons Id
a') }
    ShAAppl "StringNull" [] _ -> (ATermTable
att0, LiteralType
StringNull)
    ShAAppl "ListCons" [a :: Int
a, b :: Int
b] _ ->
      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') ->
      case Int -> ATermTable -> (ATermTable, Id)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: Id
b') ->
      (ATermTable
att2, Id -> Id -> LiteralType
ListCons Id
a' Id
b') }}
    ShAAppl "ListNull" [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 -> LiteralType
ListNull Id
a') }
    ShAAppl "Number" [] _ -> (ATermTable
att0, LiteralType
Number)
    ShAAppl "Fraction" [] _ -> (ATermTable
att0, LiteralType
Fraction)
    ShAAppl "Floating" [] _ -> (ATermTable
att0, LiteralType
Floating)
    ShAAppl "NoLiteral" [] _ -> (ATermTable
att0, LiteralType
NoLiteral)
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, LiteralType)
forall a. String -> ShATerm -> a
fromShATermError "LiteralType" ShATerm
u