some pretty printing tests

This commit is contained in:
rhiannon morris 2023-03-16 18:19:17 +01:00
parent 6dc7177be5
commit f5fa63a6df
5 changed files with 163 additions and 5 deletions

View file

@ -85,7 +85,7 @@ export
prettyApps : PrettyHL f => PrettyHL a => Pretty.HasEnv m =>
Maybe (Doc HL) -> f -> List a -> m (Doc HL)
prettyApps pfx fun args = do
fun <- withPrec Arg $ prettyM fun
fun <- withPrec App $ prettyM fun
args <- traverse (withPrec Arg . prettyArg) args
parensIfM App $ hang 2 $ sep $ fun :: args
where
@ -120,6 +120,11 @@ export
prettyTag : TagVal -> Doc HL
prettyTag t = hl Tag $ "'" <+> fromString t
-- [fixme] put delimiters around tags that aren't simple names
export
prettyTagBare : TagVal -> Doc HL
prettyTagBare t = hl Tag $ fromString t
parameters (showSubsts : Bool)
mutual
@ -139,7 +144,7 @@ parameters (showSubsts : Bool)
let GotPairs {init, last, _} = getPairs' [< s] t in
prettyTuple $ toList $ init :< last
prettyM (Enum tags) =
pure $ delims "{" "}" . aseparate comma $ map prettyTag $
pure $ delims "{" "}" . aseparate comma $ map prettyTagBare $
Prelude.toList tags
prettyM (Tag t) =
pure $ prettyTag t