-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOutput.hs
43 lines (39 loc) · 1.11 KB
/
Output.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module Output
-- * Colors
( red
, green
, yellow
, blue
, magenta
, cyan
, white
-- * Output
, putAct
, putInf
, putErr
, putWrn
, putInd
) where
resetCode, redCode, greenCode, yellowCode, blueCode, magentaCode, cyanCode, whiteCode :: String
resetCode = "\ESC[0m"
redCode = "\ESC[31;01m"
greenCode = "\ESC[32;01m"
yellowCode = "\ESC[33;01m"
blueCode = "\ESC[34;01m"
magentaCode = "\ESC[35;01m"
cyanCode = "\ESC[36;01m"
whiteCode = "\ESC[37;01m"
red, green, yellow, blue, magenta, cyan, white :: String -> String
red s = redCode ++ s ++ resetCode
green s = greenCode ++ s ++ resetCode
yellow s = yellowCode ++ s ++ resetCode
blue s = blueCode ++ s ++ resetCode
magenta s = magentaCode ++ s ++ resetCode
cyan s = cyanCode ++ s ++ resetCode
white s = whiteCode ++ s ++ resetCode
putAct, putInf, putErr, putWrn, putInd :: String -> IO ()
putAct s = putStrLn $ green ">> " ++ s ++ "..."
putInf s = putStrLn $ white ":: " ++ s
putErr s = putStrLn $ red "!! " ++ s
putWrn s = putStrLn $ yellow "** " ++ s
putInd s = putStrLn $ " " ++ s