Diagnostic: allow printing without colors

This commit is contained in:
Mesabloo 2020-09-24 20:45:46 +02:00
parent a4d52a8b1c
commit fbb1577c6d

View File

@ -37,5 +37,5 @@ instance (Foldable s, PrettyText (s a), PrettyText m) => PrettyText (Diagnostic
-- | Prints a @'Diagnostic' s m a@ To the given @'Handle'@ -- | Prints a @'Diagnostic' s m a@ To the given @'Handle'@
printDiagnostic :: (Foldable s, PrettyText (s a), PrettyText m) => Handle -> Diagnostic s m a -> IO () printDiagnostic :: (Foldable s, PrettyText (s a), PrettyText m) => Bool -> Handle -> Diagnostic s m a -> IO ()
printDiagnostic handle diag = displayIO handle (renderPretty 0.9 80 $ prettyText diag) printDiagnostic withColor handle diag = displayIO handle (renderPretty 0.9 80 . (if withColor then id else plain) $ prettyText diag)