summaryrefslogtreecommitdiff
path: root/src/PGF
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-05-12 20:52:18 +0000
committerkrasimir <krasimir@chalmers.se>2009-05-12 20:52:18 +0000
commitb037cbc361da5933e7c37f0117e46fbc07d2594f (patch)
tree0fe12f72d5109daba8f91d407a30e70f4bb8b59e /src/PGF
parentf283944f5c8dc043b32bee8a507d67acd256e225 (diff)
added command ai which prints information about given identifier
Diffstat (limited to 'src/PGF')
-rw-r--r--src/PGF/Type.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/PGF/Type.hs b/src/PGF/Type.hs
index fec8c0ff2..8c513ffd4 100644
--- a/src/PGF/Type.hs
+++ b/src/PGF/Type.hs
@@ -1,6 +1,6 @@
module PGF.Type ( Type(..), Hypo(..),
readType, showType,
- pType, ppType ) where
+ pType, ppType, ppHypo ) where
import PGF.CId
import PGF.Expr
@@ -67,12 +67,13 @@ ppType d (DTyp ctxt cat args)
| null ctxt = ppRes cat args
| otherwise = ppParens (d > 0) (foldr ppCtxt (ppRes cat args) ctxt)
where
- ppCtxt (Hyp x typ) doc
- | x == wildCId = ppType 1 typ PP.<+> PP.text "->" PP.<+> doc
- | otherwise = PP.parens (PP.text (prCId x) PP.<+> PP.char ':' PP.<+> ppType 0 typ) PP.<+> PP.text "->" PP.<+> doc
-
+ ppCtxt hyp doc = ppHypo hyp PP.<+> PP.text "->" PP.<+> doc
ppRes cat es = PP.text (prCId cat) PP.<+> PP.hsep (map (ppExpr 2) es)
+ppHypo (Hyp x typ)
+ | x == wildCId = ppType 1 typ
+ | otherwise = PP.parens (PP.text (prCId x) PP.<+> PP.char ':' PP.<+> ppType 0 typ)
+
ppParens :: Bool -> PP.Doc -> PP.Doc
ppParens True = PP.parens
ppParens False = id