From fbb1577c6dfeb4d526556a8b65d47394ad7b367d Mon Sep 17 00:00:00 2001 From: Mesabloo <22964017+Mesabloo@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:45:46 +0200 Subject: [PATCH] Diagnostic: allow printing without colors --- src/Text/Diagnose/Diagnostic.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Text/Diagnose/Diagnostic.hs b/src/Text/Diagnose/Diagnostic.hs index 465d6a1..159700b 100644 --- a/src/Text/Diagnose/Diagnostic.hs +++ b/src/Text/Diagnose/Diagnostic.hs @@ -37,5 +37,5 @@ instance (Foldable s, PrettyText (s a), PrettyText m) => PrettyText (Diagnostic -- | 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 handle diag = displayIO handle (renderPretty 0.9 80 $ prettyText diag) +printDiagnostic :: (Foldable s, PrettyText (s a), PrettyText m) => Bool -> Handle -> Diagnostic s m a -> IO () +printDiagnostic withColor handle diag = displayIO handle (renderPretty 0.9 80 . (if withColor then id else plain) $ prettyText diag)