{-# OPTIONS_GHC -fglasgow-exts #-}moduleHyLo.Signature.Simple(SimpleSignature,PropSymbol(..),NomSymbol(..),RelSymbol(..),inv,--unit_tests)whereimportTest.QuickCheck(Arbitrary(..),oneof,variant)importHyLo.Test(UnitTest,runTest)importControl.Monad(liftM)importHyLo.Signature(Signature,IsRelSym(..))importText.Read(Read(..))importText.ParserCombinators.ReadPrec(get,(<++))newtypePropSymbol=PropSymbolIntderiving(Eq,Ord,Enum,Arbitrary)instanceShowPropSymbolwhereshowsPrec_(PropSymboli)=('P':).showsiinstanceReadPropSymbolwherereadPrec=do'P'<-get;PropSymbol`liftM`readPrec-- N will be used by the input file parser for unboundable nominals,-- X will be used for boundable nominalsdataNomSymbol=NInt|XIntderiving(Eq,Ord)instanceShowNomSymbolwhereshowsPrec_(Ni)=('N':).showsishowsPrec_(Xi)=('X':).showsiinstanceReadNomSymbolwherereadPrec=(do'N'<-get;N`liftM`readPrec)<++(do'X'<-get;X`liftM`readPrec)dataRelSymbol=RelSymbolInt|InvRelSymbolIntderiving(Eq,Ord)instanceShowRelSymbolwhereshowsPrec_(RelSymboli)=('R':).showsishowsPrec_(InvRelSymboli)=('-':).('R':).showsiinstanceReadRelSymbolwherereadPrec=(do'R'<-get;RelSymbol`liftM`readPrec)<++(do'-'<-get;'R'<-get;InvRelSymbol`liftM`readPrec)inv::RelSymbol->RelSymbolinv(RelSymbolr)=InvRelSymbolrinv(InvRelSymbolr)=RelSymbolrinstanceIsRelSymRelSymbolwhereinvRel=Just.invtypeSimpleSignature=SignatureNomSymbolPropSymbolRelSymbolinstanceArbitraryNomSymbolwherearbitrary=oneof[N`liftM`arbitrary,X`liftM`arbitrary]--coarbitrary(Ni)=variant0.coarbitraryicoarbitrary(Xi)=variant1.coarbitraryiinstanceArbitraryRelSymbolwherearbitrary=oneof[RelSymbol`liftM`arbitrary,InvRelSymbol`liftM`arbitrary]--coarbitrary(RelSymbolr)=variant0.coarbitraryrcoarbitrary(InvRelSymbolr)=variant1.coarbitraryrprop_read_PropSymbol::PropSymbol->Boolprop_read_PropSymbolp=p==(read.show$p)prop_read_NomSymbol::NomSymbol->Boolprop_read_NomSymboli=i==(read.show$i)prop_read_RelSymbol::RelSymbol->Boolprop_read_RelSymbolr=r==(read.show$r)unit_tests::UnitTestunit_tests=[("read/show - PropSymbol",runTestprop_read_PropSymbol),("read/show - NomSymbol",runTestprop_read_NomSymbol),("read/show - RelSymbol",runTestprop_read_RelSymbol)]