module CASL_DL.Print_AS where
import Common.Doc
import Common.DocUtils
import CASL.ToDoc
import CASL_DL.AS_CASL_DL
instance FormExtension DL_FORMULA
instance Pretty DL_FORMULA where
pretty :: DL_FORMULA -> Doc
pretty (Cardinality ct :: CardType
ct pn :: PRED_SYMB
pn varTerm :: TERM DL_FORMULA
varTerm natTerm :: TERM DL_FORMULA
natTerm qualTerm :: Maybe (FORMULA DL_FORMULA)
qualTerm _) =
String -> Doc
text (CardType -> String
forall a. Show a => a -> String
show CardType
ct)
Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
brackets (PRED_SYMB -> Doc
forall a. Pretty a => a -> Doc
pretty PRED_SYMB
pn)
Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc -> Doc
parens (TERM DL_FORMULA -> Doc
forall a. Pretty a => a -> Doc
pretty TERM DL_FORMULA
varTerm Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> Doc
comma Doc -> Doc -> Doc
<+> TERM DL_FORMULA -> Doc
forall a. Pretty a => a -> Doc
pretty TERM DL_FORMULA
natTerm
Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
<> case Maybe (FORMULA DL_FORMULA)
qualTerm of
Nothing -> Doc
empty
Just x :: FORMULA DL_FORMULA
x -> Doc
comma Doc -> Doc -> Doc
<+> FORMULA DL_FORMULA -> Doc
forall a. Pretty a => a -> Doc
pretty FORMULA DL_FORMULA
x)