terse pretty-printing

This commit is contained in:
crumbtoo
2024-02-27 06:14:02 -07:00
parent 1315ea7ea8
commit b67fe4eb2d
7 changed files with 139 additions and 30 deletions

View File

@@ -6,8 +6,11 @@ module Data.Pretty
, hsepOf, vsepOf
, vcatOf
, vlinesOf
, vsepTerm
, module Text.PrettyPrint
, maybeParens
, appPrec
, appPrec1
)
where
----------------------------------------------------------------------------------
@@ -63,3 +66,12 @@ vlinesOf :: Getting (Endo Doc) s Doc -> s -> Doc
vlinesOf l = foldrOf l (\a b -> a $+$ "" $+$ b) mempty
-- hack(?) to separate chunks with a blankline
vsepTerm :: Doc -> Doc -> Doc -> Doc
vsepTerm term a b = (a <> term) $+$ b
--------------------------------------------------------------------------------
appPrec, appPrec1 :: Int
appPrec = 10
appPrec1 = 11