PrintLe.hs revision c438c79d00fc438f99627e612498744bdc0d0c89
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina SojakovaModule : $Header$
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina SojakovaCopyright : (c) Christian Maeder and Uni Bremen 2002-2003
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina SojakovaMaintainer : maeder@tzi.de
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuStability : experimental
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina SojakovaPortability : portable
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovapretty printing a HasCASL environment
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovaimport qualified Common.Lib.Map as Map
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovaimport qualified Common.Lib.Set as Set
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrettyPrint Morphism where
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder printText0 ga = toText ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrettyPrint Env where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printText0 ga = toText (addBuiltins ga) . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrettyPrint Sentence where
1a38107941725211e7c3f051f7a8f5e12199f03acmaeder printText0 ga = toText (addBuiltins ga) . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrettyPrint SymbMapItems where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printText0 ga = toText ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrettyPrint SymbItems where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printText0 ga = toText ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrettyPrint RawSymbol where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printText0 ga = toText ga . pretty
1a38107941725211e7c3f051f7a8f5e12199f03acmaederinstance PrettyPrint Symbol where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printText0 ga = toText ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrintLaTeX Morphism where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printLatex0 ga = toLatex ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrintLaTeX Env where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printLatex0 ga = toLatex (addBuiltins ga) . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrintLaTeX Sentence where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printLatex0 ga = toLatex (addBuiltins ga) . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrintLaTeX SymbMapItems where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printLatex0 ga = toLatex ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrintLaTeX SymbItems where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printLatex0 ga = toLatex ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrintLaTeX RawSymbol where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printLatex0 ga = toLatex ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance PrintLaTeX Symbol where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova printLatex0 ga = toLatex ga . pretty
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakovainstance Pretty ClassInfo where
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova pretty (ClassInfo rk ks) = case ks of
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova [] -> colon <+> pretty rk
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina Sojakova _ -> text lessS <+> printList0 ks
ccaa75089b23c0f043cdbd4001cba4e076ca4fd3Kristina SojakovaprintGenKind :: GenKind -> Doc
++ (if Set.null sups then []
else [less, printList0 $ Set.toList sups])
++ if Map.null im then []
let oops = foldr Map.delete ops $ map fst bList
in noPrint (Map.null cm) (header "Classes")
$+$ noPrint (Map.null otm) (header "Type Constructors")
$+$ noPrint (Map.null tvs) (header "Type Variables")
$+$ noPrint (Map.null oops) (header "Assumptions")
$+$ noPrint (Map.null vs) (header "Variables")
printMap0 :: (Pretty a, Ord a, Pretty b) => Map.Map a b -> Doc
printMap1 :: (Pretty a, Ord a, Pretty b) => Map.Map a b -> Doc
printMap :: (Pretty a, Ord a, Pretty b) => [Doc] -> Map.Map a b -> Doc
pretty a : d ++ [pretty b]) $ Map.toList m
ds = Map.foldWithKey ( \ (i, s) (j, t) l ->
in (if Map.null tm then empty
$+$ (if Map.null fm then empty