From 67aa6e7a81d8d22ff8409ed59fab7bacde2312a6 Mon Sep 17 00:00:00 2001 From: peb Date: Tue, 29 Mar 2005 10:17:53 +0000 Subject: "Committed_by_peb" --- src/GF/Printing/PrintParser.hs | 8 ++++++-- src/GF/Printing/PrintSimplifiedTerm.hs | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/GF/Printing') diff --git a/src/GF/Printing/PrintParser.hs b/src/GF/Printing/PrintParser.hs index 3971f0a40..0869bf685 100644 --- a/src/GF/Printing/PrintParser.hs +++ b/src/GF/Printing/PrintParser.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/03/21 14:17:44 $ +-- > CVS $Date: 2005/03/29 11:17:56 $ -- > CVS $Author: peb $ --- > CVS $Revision: 1.1 $ +-- > CVS $Revision: 1.2 $ -- -- Pretty-printing of parser objects ----------------------------------------------------------------------------- @@ -69,6 +69,10 @@ instance Print Int where instance Print Integer where prt = show +instance Print a => Print (Maybe a) where + prt (Just a) = "!" ++ prt a + prt Nothing = "Nothing" + instance Print a => Print (Err a) where prt (Ok a) = prt a prt (Bad str) = str diff --git a/src/GF/Printing/PrintSimplifiedTerm.hs b/src/GF/Printing/PrintSimplifiedTerm.hs index 9425f6f4d..bde186549 100644 --- a/src/GF/Printing/PrintSimplifiedTerm.hs +++ b/src/GF/Printing/PrintSimplifiedTerm.hs @@ -5,9 +5,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/03/21 14:17:44 $ +-- > CVS $Date: 2005/03/29 11:17:56 $ -- > CVS $Author: peb $ --- > CVS $Revision: 1.1 $ +-- > CVS $Revision: 1.2 $ -- -- Instances for printing terms in a simplified format ----------------------------------------------------------------------------- @@ -19,6 +19,7 @@ import AbsGFC import CF import CFIdent import GF.Printing.PrintParser +import qualified PrintGFC as P instance Print Term where prt (Arg arg) = prt arg @@ -100,6 +101,10 @@ instance Print CFCat where instance Print CFFun where prt (CFFun fun) = prt (fst fun) +instance Print Exp where + prt = P.printTree + + sizeCT :: CType -> Int sizeCT (RecType rt) = 1 + sum [ sizeCT t | _ `Lbg` t <- rt ] sizeCT (Table pt vt) = 1 + sizeCT pt + sizeCT vt -- cgit v1.2.3