]> gitweb.michael.orlitzky.com - dead/htsn.git/blobdiff - src/Terminal.hs
Ad rudimentary hslogger logging.
[dead/htsn.git] / src / Terminal.hs
index cd35bf0e08bc1c2e85083f8568054845471a5110..7e8850519303a497da3813593c295388df60d288 100644 (file)
@@ -1,6 +1,7 @@
 module Terminal (
-  putGreenLn,
-  report_error)
+  hPutBlueStr,
+  hPutRedStr,
+  putGreenLn )
 where
 
 import Control.Monad.IO.Class (MonadIO(..))
@@ -10,7 +11,7 @@ import System.Console.ANSI (
   ColorIntensity( Vivid ),
   ConsoleLayer( Foreground ),
   setSGR )
-import System.IO ( Handle, hPutStrLn, stderr )
+import System.IO ( Handle, hPutStr )
 
 -- | Perform a computation (anything in MonadIO) with the given
 --   graphics mode(s) enabled. Revert to the previous graphics mode
@@ -32,14 +33,15 @@ with_color color =
 
 -- | Output the given line to the given handle, in red. The silly
 --   camelCase name is for consistency with e.g. hPutStrLn.
-hPutRedLn :: Handle -> String -> IO ()
-hPutRedLn h = with_color Red . hPutStrLn h
+hPutRedStr :: Handle -> String -> IO ()
+hPutRedStr h = with_color Red . hPutStr h
 
--- | Output the given line to stdout. The silly camelCase name is for
---   consistency with e.g. putStrLn.
+-- | Output the given line to the given handle, in blue. The silly
+--   camelCase name is for consistency with e.g. hPutStrLn.
+hPutBlueStr :: Handle -> String -> IO ()
+hPutBlueStr h = with_color Blue . hPutStr h
+
+-- | Output the given line to stdout, in green. The silly camelCase
+--   name is for consistency with e.g. putStrLn.
 putGreenLn :: String -> IO ()
 putGreenLn = with_color Green . putStrLn
-
--- | Report an error (to stderr).
-report_error :: String -> IO ()
-report_error = hPutRedLn stderr