X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FTerminal.hs;h=7e8850519303a497da3813593c295388df60d288;hp=cd35bf0e08bc1c2e85083f8568054845471a5110;hb=49c23c133221c9686dde0d52d06904db8d048724;hpb=0b1b4dc983422e7bebf1ec2a23632bd16368689f diff --git a/src/Terminal.hs b/src/Terminal.hs index cd35bf0..7e88505 100644 --- a/src/Terminal.hs +++ b/src/Terminal.hs @@ -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