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

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

module ATC.IRI () where

import ATC.Id
import ATerm.Lib
import Common.IRI
import Common.Id as Id
import Common.Json.Instances
import Common.Lexer
import Common.Parsec
import Common.Percent
import Common.Token (comps)
import Data.Aeson(ToJSON, FromJSON)
import Data.Char
import Data.Data
import Data.List
import Data.Map as Map (Map, lookup)
import Data.Maybe
import Data.Ord (comparing)
import GHC.Generics(Generic)
import Text.ParserCombinators.Parsec
import qualified Control.Monad.Fail as Fail

{-! for Common.IRI.IRI derive : ShATermConvertible !-}
{-! for Common.IRI.IRIAuth derive : ShATermConvertible !-}

{-! for Common.IRI.IRI derive : Json !-}
{-! for Common.IRI.IRIAuth derive : Json !-}

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

deriving instance GHC.Generics.Generic Common.IRI.IRIAuth
instance Data.Aeson.ToJSON Common.IRI.IRIAuth where
instance Data.Aeson.FromJSON Common.IRI.IRIAuth where

deriving instance GHC.Generics.Generic Common.IRI.IRI
instance Data.Aeson.ToJSON Common.IRI.IRI where
instance Data.Aeson.FromJSON Common.IRI.IRI where

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

instance ShATermConvertible Common.IRI.IRI where
  toShATermAux :: ATermTable -> IRI -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 xv :: IRI
xv = case IRI
xv of
    IRI a :: Range
a b :: String
b c :: Maybe IRIAuth
c d :: Id
d e :: String
e f :: String
f g :: String
g h :: String
h i :: Bool
i j :: Bool
j k :: Bool
k -> do
      (att1 :: ATermTable
att1, a' :: Int
a') <- ATermTable -> Range -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att0 Range
a
      (att2 :: ATermTable
att2, b' :: Int
b') <- ATermTable -> String -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att1 String
b
      (att3 :: ATermTable
att3, c' :: Int
c') <- ATermTable -> Maybe IRIAuth -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att2 Maybe IRIAuth
c
      (att4 :: ATermTable
att4, d' :: Int
d') <- ATermTable -> Id -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att3 Id
d
      (att5 :: ATermTable
att5, e' :: Int
e') <- ATermTable -> String -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att4 String
e
      (att6 :: ATermTable
att6, f' :: Int
f') <- ATermTable -> String -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att5 String
f
      (att7 :: ATermTable
att7, g' :: Int
g') <- ATermTable -> String -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att6 String
g
      (att8 :: ATermTable
att8, h' :: Int
h') <- ATermTable -> String -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att7 String
h
      (att9 :: ATermTable
att9, i' :: Int
i') <- ATermTable -> Bool -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att8 Bool
i
      (att10 :: ATermTable
att10, j' :: Int
j') <- ATermTable -> Bool -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att9 Bool
j
      (att11 :: ATermTable
att11, k' :: Int
k') <- ATermTable -> Bool -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATerm' ATermTable
att10 Bool
k
      (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 "IRI" [Int
a', Int
b', Int
c', Int
d', Int
e', Int
f', Int
g', Int
h',
                                        Int
i', Int
j', Int
k'] []) ATermTable
att11
  fromShATermAux :: Int -> ATermTable -> (ATermTable, IRI)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = case Int -> ATermTable -> ShATerm
getShATerm Int
ix ATermTable
att0 of
    ShAAppl "IRI" [a :: Int
a, b :: Int
b, c :: Int
c, d :: Int
d, e :: Int
e, f :: Int
f, g :: Int
g, h :: Int
h, i :: Int
i, j :: Int
j, k :: Int
k] _ ->
      case Int -> ATermTable -> (ATermTable, Range)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
a ATermTable
att0 of
      { (att1 :: ATermTable
att1, a' :: Range
a') ->
      case Int -> ATermTable -> (ATermTable, String)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
b ATermTable
att1 of
      { (att2 :: ATermTable
att2, b' :: String
b') ->
      case Int -> ATermTable -> (ATermTable, Maybe IRIAuth)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
c ATermTable
att2 of
      { (att3 :: ATermTable
att3, c' :: Maybe IRIAuth
c') ->
      case Int -> ATermTable -> (ATermTable, Id)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
d ATermTable
att3 of
      { (att4 :: ATermTable
att4, d' :: Id
d') ->
      case Int -> ATermTable -> (ATermTable, String)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
e ATermTable
att4 of
      { (att5 :: ATermTable
att5, e' :: String
e') ->
      case Int -> ATermTable -> (ATermTable, String)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
f ATermTable
att5 of
      { (att6 :: ATermTable
att6, f' :: String
f') ->
      case Int -> ATermTable -> (ATermTable, String)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
g ATermTable
att6 of
      { (att7 :: ATermTable
att7, g' :: String
g') ->
      case Int -> ATermTable -> (ATermTable, String)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
h ATermTable
att7 of
      { (att8 :: ATermTable
att8, h' :: String
h') ->
      case Int -> ATermTable -> (ATermTable, Bool)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
i ATermTable
att8 of
      { (att9 :: ATermTable
att9, i' :: Bool
i') ->
      case Int -> ATermTable -> (ATermTable, Bool)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
j ATermTable
att9 of
      { (att10 :: ATermTable
att10, j' :: Bool
j') ->
      case Int -> ATermTable -> (ATermTable, Bool)
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATerm' Int
k ATermTable
att10 of
      { (att11 :: ATermTable
att11, k' :: Bool
k') ->
      (ATermTable
att11, Range
-> String
-> Maybe IRIAuth
-> Id
-> String
-> String
-> String
-> String
-> Bool
-> Bool
-> Bool
-> IRI
IRI Range
a' String
b' Maybe IRIAuth
c' Id
d' String
e' String
f' String
g' String
h' Bool
i' Bool
j' Bool
k') }}}}}}}}}}}
    u :: ShATerm
u -> String -> ShATerm -> (ATermTable, IRI)
forall a. String -> ShATerm -> a
fromShATermError "Common.IRI.IRI" ShATerm
u