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

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

module ATC.OrderedMap () where

import ATerm.Lib
import Common.Json.Instances
import Common.OrderedMap
import Data.Aeson(ToJSON, FromJSON)
import Data.Data
import Data.Ord
import GHC.Generics(Generic)
import Prelude hiding (lookup, map, filter, null)
import qualified Control.Monad.Fail as Fail
import qualified Data.List as List
import qualified Data.Map as Map

{-! for Common.OrderedMap.ElemWOrd derive : ShATermConvertible !-}

{-! for Common.OrderedMap.ElemWOrd derive : Json !-}

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

deriving instance GHC.Generics.Generic (Common.OrderedMap.ElemWOrd a)
instance Data.Aeson.ToJSON a => Data.Aeson.ToJSON (Common.OrderedMap.ElemWOrd a) where
instance Data.Aeson.FromJSON a => Data.Aeson.FromJSON (Common.OrderedMap.ElemWOrd a) where

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