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

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

module ATC.LibName () where

import ATC.IRI
import ATerm.Lib
import Common.ATerm.ConvInstances
import Common.Doc
import Common.DocUtils
import Common.IRI
import Common.Id
import Common.Json.ConvInstances
import Common.Json.Instances
import Common.Keywords
import Common.LibName
import Common.Percent
import Common.Utils
import Data.Aeson(ToJSON, FromJSON)
import Data.Char
import Data.Data
import Data.List
import Data.Maybe
import Data.Ord
import GHC.Generics(Generic)
import System.FilePath

{-! for Common.LibName.LibName derive : ShATermConvertible !-}
{-! for Common.LibName.VersionNumber derive : ShATermConvertible !-}

{-! for Common.LibName.LibName derive : Json !-}
{-! for Common.LibName.VersionNumber derive : Json !-}

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

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

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

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

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