{-# OPTIONS -w -O0 #-}
{- |
Module      :  ATC/IRI.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):
'Common.IRI.IRI'
'Common.IRI.IRIAuth'
'Common.IRI.PNameLn'
-}

{-
  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
import Common.Lexer
import Common.Parsec
import Control.Monad (MonadPlus (..))
import Data.Char (ord, chr, isHexDigit, toLower, toUpper, digitToInt)
import Data.Map as Map (Map, lookup)
import Data.Ord (comparing)
import Data.Typeable
import Numeric (showIntAtBase)
import Text.ParserCombinators.Parsec (GenParser, ParseError
    , parse, (<|>), (<?>), try
    , option, many, many1
    , char, satisfy, oneOf, string, digit, eof
    , unexpected
    )

{-! for Common.IRI.IRI derive : Typeable !-}
{-! for Common.IRI.IRIAuth derive : Typeable !-}
{-! for Common.IRI.PNameLn derive : Typeable !-}

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

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

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

instance ShATermConvertible IRIAuth where
  toShATermAux att0 xv = case xv of
    IRIAuth a b c -> do
      (att1, a') <- toShATerm' att0 a
      (att2, b') <- toShATerm' att1 b
      (att3, c') <- toShATerm' att2 c
      return $ addATerm (ShAAppl "IRIAuth" [a', b', c'] []) att3
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "IRIAuth" [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, IRIAuth a' b' c') }}}
    u -> fromShATermError "IRIAuth" u

instance ShATermConvertible IRI where
  toShATermAux att0 xv = case xv of
    IRI a b c d e f g h i j -> 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
      (att6, f') <- toShATerm' att5 f
      (att7, g') <- toShATerm' att6 g
      (att8, h') <- toShATerm' att7 h
      (att9, i') <- toShATerm' att8 i
      (att10, j') <- toShATerm' att9 j
      return $ addATerm (ShAAppl "IRI" [a', b', c', d', e', f', g', h',
                                        i', j'] []) att10
  fromShATermAux ix att0 = case getShATerm ix att0 of
    ShAAppl "IRI" [a, b, c, d, e, f, g, h, i, j] _ ->
      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') ->
      case fromShATerm' f att5 of
      { (att6, f') ->
      case fromShATerm' g att6 of
      { (att7, g') ->
      case fromShATerm' h att7 of
      { (att8, h') ->
      case fromShATerm' i att8 of
      { (att9, i') ->
      case fromShATerm' j att9 of
      { (att10, j') ->
      (att10, IRI a' b' c' d' e' f' g' h' i' j') }}}}}}}}}}
    u -> fromShATermError "IRI" u

_tcPNameLnTc :: TyCon
_tcPNameLnTc = mkTyCon "Common.IRI.PNameLn"
instance Typeable PNameLn where
    typeOf _ = mkTyConApp _tcPNameLnTc []

_tcIRIAuthTc :: TyCon
_tcIRIAuthTc = mkTyCon "Common.IRI.IRIAuth"
instance Typeable IRIAuth where
    typeOf _ = mkTyConApp _tcIRIAuthTc []

_tcIRITc :: TyCon
_tcIRITc = mkTyCon "Common.IRI.IRI"
instance Typeable IRI where
    typeOf _ = mkTyConApp _tcIRITc []
