From de4275d9728104167726bda4d260c197a40ff3d7 Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Thu, 12 Jan 2023 17:55:43 +0000 Subject: Slightly prettify pretty printing. --- src/Obs/NormalForm.idr | 12 ++++++------ src/Obs/Pretty.idr | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Obs/NormalForm.idr b/src/Obs/NormalForm.idr index b290240..3139daf 100644 --- a/src/Obs/NormalForm.idr +++ b/src/Obs/NormalForm.idr @@ -142,7 +142,7 @@ prettyPrecCnstr d Bool = pretty "Bool" prettyPrecCnstr d True = pretty "True" prettyPrecCnstr d False = pretty "False" prettyPrecCnstr d (Box {prop}) = prettyApp d (pretty "Box") [prettyPrec App prop] -prettyPrecCnstr d MkBox = pretty "box" +prettyPrecCnstr d MkBox = prettyApp d (pretty "box") [pretty "_"] prettyPrecCnstr d Top = pretty "()" prettyPrecCnstr d Bottom = pretty "Void" @@ -156,8 +156,8 @@ prettyPrecNtrl d (Second {firstRel, arg}) = prettyApp d (pretty "snd") [prettyPrecNtrl App arg] prettyPrecNtrl d (If {discriminant, true, false}) = prettyApp d (pretty "if") $ - [prettyPrecNtrl App discriminant, prettyPrec App true, prettyPrec App false] -prettyPrecNtrl d Absurd = pretty "absurd" + [pretty "_", prettyPrecNtrl App discriminant, prettyPrec App true, prettyPrec App false] +prettyPrecNtrl d Absurd = prettyApp d (pretty "absurd") [pretty "_"] prettyPrecNtrl d (Equal {type, left, right}) = prettyEqual d (prettyPrec Equal left) (prettyPrec Equal right) prettyPrecNtrl d (EqualL {left, right}) = @@ -168,13 +168,13 @@ prettyPrecNtrl d (EqualStuck {left, right}) = prettyEqual d (prettyPrecCnstr Equal left) (prettyPrecCnstr Equal right) prettyPrecNtrl d (CastL {oldType, newType, value}) = prettyApp d (pretty "cast") $ - [prettyPrecNtrl App oldType, prettyPrec App newType, prettyPrec App value] + [prettyPrecNtrl App oldType, prettyPrec App newType, pretty "_", prettyPrec App value] prettyPrecNtrl d (CastR {oldType, newType, value}) = prettyApp d (pretty "cast") $ - [prettyPrecCnstr App oldType, prettyPrecNtrl App newType, prettyPrec App value] + [prettyPrecCnstr App oldType, prettyPrecNtrl App newType, pretty "_", prettyPrec App value] prettyPrecNtrl d (CastStuck {oldType, newType, value}) = prettyApp d (pretty "cast") $ - [prettyPrecCnstr App oldType, prettyPrecCnstr App newType, prettyPrec App value] + [prettyPrecCnstr App oldType, prettyPrecCnstr App newType, pretty "_", prettyPrec App value] prettyPrec d (Ntrl t) = prettyPrecNtrl d t prettyPrec d (Cnstr t) = prettyPrecCnstr d t diff --git a/src/Obs/Pretty.idr b/src/Obs/Pretty.idr index 656f352..f32542e 100644 --- a/src/Obs/Pretty.idr +++ b/src/Obs/Pretty.idr @@ -33,7 +33,7 @@ prettyLambda d name body = export prettyApp : (prec : Prec) -> (head : Doc ann) -> (tail : List (Doc ann)) -> Doc ann prettyApp d head tail = - parenthesise (d >= App) $ align $ group $ vsep (align head :: map (hang 2) tail) + parenthesise (d >= App) $ hang 2 $ group $ vsep (align head :: tail) -- first and second are rendered Open export -- cgit v1.2.3