summaryrefslogtreecommitdiff
path: root/Pretty.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Pretty.hs')
-rw-r--r--Pretty.hs5
1 files changed, 5 insertions, 0 deletions
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