module NeSyPatterns.ATC_Relation where

import ATerm.Lib
import qualified Data.Relation as Rel


instance (ShATermConvertible a, ShATermConvertible b, Ord a, Ord b) => ShATermConvertible (Rel.Relation a b) where
  toShATermAux :: ATermTable -> Relation a b -> IO (ATermTable, Int)
toShATermAux att0 :: ATermTable
att0 = ATermTable -> [(a, b)] -> IO (ATermTable, Int)
forall t.
ShATermConvertible t =>
ATermTable -> t -> IO (ATermTable, Int)
toShATermAux ATermTable
att0 ([(a, b)] -> IO (ATermTable, Int))
-> (Relation a b -> [(a, b)])
-> Relation a b
-> IO (ATermTable, Int)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Relation a b -> [(a, b)]
forall a b. Relation a b -> [(a, b)]
Rel.toList
  fromShATermAux :: Int -> ATermTable -> (ATermTable, Relation a b)
fromShATermAux ix :: Int
ix att0 :: ATermTable
att0 = [(a, b)] -> Relation a b
forall a b. (Ord a, Ord b) => [(a, b)] -> Relation a b
Rel.fromList ([(a, b)] -> Relation a b)
-> (ATermTable, [(a, b)]) -> (ATermTable, Relation a b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> ATermTable -> (ATermTable, [(a, b)])
forall t.
ShATermConvertible t =>
Int -> ATermTable -> (ATermTable, t)
fromShATermAux Int
ix ATermTable
att0