summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2023-01-12 17:55:43 +0000
committerGreg Brown <greg.brown01@ed.ac.uk>2023-01-12 17:55:43 +0000
commitde4275d9728104167726bda4d260c197a40ff3d7 (patch)
treeb40755a73ec9945f301348857abc657f4bd517d9
parent3a521624bb1458333a7fd23a0712cbc1f8fc5e1d (diff)
Slightly prettify pretty printing.
-rw-r--r--src/Obs/NormalForm.idr12
-rw-r--r--src/Obs/Pretty.idr2
2 files changed, 7 insertions, 7 deletions
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