summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r--compiler/utils/Outputable.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index d61b1ec802..ee0147d308 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -19,6 +19,7 @@ module Outputable (
docToSDoc,
interppSP, interpp'SP,
pprQuotedList, pprWithCommas, quotedListWithOr, quotedListWithNor,
+ pprWithBars,
empty, isEmpty, nest,
char,
text, ftext, ptext, ztext,
@@ -113,6 +114,7 @@ import System.FilePath
import Text.Printf
import Numeric (showFFloat)
import Data.Graph (SCC(..))
+import Data.List (intersperse)
import GHC.Fingerprint
import GHC.Show ( showMultiLineString )
@@ -936,6 +938,12 @@ pprWithCommas :: (a -> SDoc) -- ^ The pretty printing function to use
-- comma-separated and finally packed into a paragraph.
pprWithCommas pp xs = fsep (punctuate comma (map pp xs))
+pprWithBars :: (a -> SDoc) -- ^ The pretty printing function to use
+ -> [a] -- ^ The things to be pretty printed
+ -> SDoc -- ^ 'SDoc' where the things have been pretty printed,
+ -- bar-separated and finally packed into a paragraph.
+pprWithBars pp xs = fsep (intersperse vbar (map pp xs))
+
-- | Returns the separated concatenation of the pretty printed things.
interppSP :: Outputable a => [a] -> SDoc
interppSP xs = sep (map ppr xs)