From 953b23229f38f1b76d130086a213d565f13cdc06 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 25 May 2021 21:45:22 +0200 Subject: Make it work --- Pretty.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Pretty.hs') diff --git a/Pretty.hs b/Pretty.hs index a5b65a6..2f0afdc 100644 --- a/Pretty.hs +++ b/Pretty.hs @@ -3,6 +3,8 @@ module Pretty where import qualified Data.Text.Lazy.Builder as B import Data.Text.Lazy.Builder (Builder) import Data.Text.Lazy (Text) +import System.IO (hIsTerminalDevice, stdout) +import System.IO.Unsafe (unsafePerformIO) class Pretty a where @@ -10,3 +12,6 @@ class Pretty a where pretty :: a -> Text pretty = B.toLazyText . pretty' + +stdoutIsTTY :: Bool +stdoutIsTTY = unsafePerformIO $ hIsTerminalDevice stdout -- cgit v1.2.3-70-g09d2