From a19be6a7ee6b379da5bde253f230733438c357bf Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Thu, 11 Feb 2016 13:31:33 +0100 Subject: [PATCH] Fix printing of environments --- CTT.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CTT.hs b/CTT.hs index 11d80d8..e3d42f9 100644 --- a/CTT.hs +++ b/CTT.hs @@ -281,21 +281,22 @@ showEnv :: Bool -> Env -> Doc showEnv b e = let -- This decides if we should print "x = " or not names x = if b then text x <+> equals else PP.empty - + par x = if b then parens x else x + com = if b then comma else PP.empty showEnv1 e = case e of (Upd x env,u:us,fs) -> - showEnv1 (env,us,fs) <+> names x <+> showVal1 u + showEnv1 (env,us,fs) <+> names x <+> showVal1 u <> com (Sub i env,us,phi:fs) -> - showEnv1 (env,us,fs) <+> names (show i) <+> text (show phi) + showEnv1 (env,us,fs) <+> names (show i) <+> text (show phi) <> com (Def _ env,vs,fs) -> showEnv1 (env,vs,fs) _ -> showEnv b e in case e of (Empty,_,_) -> PP.empty (Def _ env,vs,fs) -> showEnv b (env,vs,fs) (Upd x env,u:us,fs) -> - showEnv1 (env,us,fs) <+> names x <+> showVal u + par $ showEnv1 (env,us,fs) <+> names x <+> showVal u (Sub i env,us,phi:fs) -> - showEnv1 (env,us,fs) <+> names (show i) <+> text (show phi) + par $ showEnv1 (env,us,fs) <+> names (show i) <+> text (show phi) instance Show Loc where show = render . showLoc -- 2.34.1