more tweaks to pretty printing.

This commit is contained in:
2024-11-15 19:13:42 -08:00
parent 9faee86886
commit 9767d92952
7 changed files with 39 additions and 24 deletions

View File

@@ -138,6 +138,16 @@ fill [] = Empty
fill [x] = x
fill (x :: y :: xs) = (flatten x <+> fill (flatten y :: xs)) `Alt` (x </> fill (y :: xs))
||| separate with space
export
commaSep : List Doc -> Doc
commaSep = folddoc (\a, b => a ++ text "," <+/> b)
public export
FromString Doc where
fromString = text
||| If we stick Doc into a String, try to avoid line-breaks via `flatten`
public export
Interpolation Doc where
interpolate = render 80 . flatten