don't rewrite log at end if nothing appended
[diohsc.git] / PrintFancy.hs
blobe0021c0943a036c7d1c5a7068068ae2285a8208d
1 -- This file is part of Diohsc
2 -- Copyright (C) 2020-23 Martin Bays <mbays@sdf.org>
3 --
4 -- This program is free software: you can redistribute it and/or modify
5 -- it under the terms of version 3 of the GNU General Public License as
6 -- published by the Free Software Foundation, or any later version.
7 --
8 -- You should have received a copy of the GNU General Public License
9 -- along with this program. If not, see http://www.gnu.org/licenses/.
11 module PrintFancy where
13 import Control.Monad.IO.Class (MonadIO, liftIO)
14 import System.IO
16 import ANSIColour
18 printErrFancy :: MonadIO m => Bool -> String -> m ()
19 printErrFancy ansi s = liftIO . hPutStrLn stderr . applyIf ansi (withColourStr BoldRed) $ "! " <> s
21 printInfoFancy :: MonadIO m => Bool -> String -> m ()
22 printInfoFancy ansi s = liftIO . hPutStrLn stderr $ applyIf ansi withBoldStr ". " <> s