From 06bd13433cb5e7edcff551454107c9d4e4d88f8f Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Thu, 5 Jan 2023 17:06:33 +0000 Subject: Add more program structure to normal forms. --- src/Obs/Pretty.idr | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/Obs/Pretty.idr') diff --git a/src/Obs/Pretty.idr b/src/Obs/Pretty.idr index 52a358c..bd163ee 100644 --- a/src/Obs/Pretty.idr +++ b/src/Obs/Pretty.idr @@ -4,19 +4,22 @@ import public Text.PrettyPrint.Prettyprinter -- ty is rendered Open export -prettyDecl : (name : String) -> (ty : Doc ann) -> Doc ann -prettyDecl name ty = parens $ group (pretty name <++> colon <+> line <+> align ty) +prettyDecl : (name : Maybe String) -> (ty : Doc ann) -> Doc ann +prettyDecl Nothing ty = parens $ group $ align ty +prettyDecl (Just name) ty = parens $ group (pretty name <++> colon <+> line <+> align ty) --- ty and tail are rendered Open +-- names are rendered Open export prettyDeclForm : (prec : Prec) -> - (name : String) -> - (ty : Doc ann) -> + (decls : List (Doc ann)) -> (sep : String) -> (tail : Doc ann) -> Doc ann -prettyDeclForm d name ty sep tail = - parenthesise (d > Open) $ group $ vsep $ [prettyDecl name ty <++> pretty sep, align tail] +prettyDeclForm d decls sep tail = + parenthesise (d > Open) $ + group $ + concatWith (\x, y => x <++> pretty sep <+> line <+> y) $ + decls ++ [align tail] -- body is rendered Open export -- cgit v1.2.3