summaryrefslogtreecommitdiff
path: root/Pretty.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2021-05-25 21:45:22 +0200
committerTom Smeding <tom@tomsmeding.com>2021-05-25 21:45:22 +0200
commit953b23229f38f1b76d130086a213d565f13cdc06 (patch)
treed59282f7a65fd2dc9ae2f40886930c632595232f /Pretty.hs
parentb03f51f3a363f861f9d5de30ec6a337fec316383 (diff)
Make it workHEADmaster
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