blob: 2f0afdcbab9b7bfd1b76ed4cee6924750284e12f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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
pretty' :: a -> Builder
pretty :: a -> Text
pretty = B.toLazyText . pretty'
stdoutIsTTY :: Bool
stdoutIsTTY = unsafePerformIO $ hIsTerminalDevice stdout
|