1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00
semantic/src/Console.hs

37 lines
732 B
Haskell
Raw Normal View History

2015-11-20 04:39:21 +03:00
module Console where
2015-11-20 05:00:03 +03:00
data Colour = Black | Red | Green | Yellow | Blue | Purple | Cyan | White
2015-11-20 05:01:50 +03:00
deriving Bounded
2015-11-20 05:01:56 +03:00
instance Enum Colour where
fromEnum Black = 30
fromEnum Red = 31
fromEnum Green = 32
fromEnum Yellow = 33
fromEnum Blue = 34
fromEnum Purple = 35
fromEnum Cyan = 36
fromEnum White = 37
toEnum 30 = Black
toEnum 31 = Red
toEnum 32 = Green
toEnum 33 = Yellow
toEnum 34 = Blue
toEnum 35 = Purple
toEnum 36 = Cyan
toEnum 37 = White
toEnum _ = error "unknown colour code"
2015-11-20 05:02:02 +03:00
data Style = Normal | Bold | Underline
2015-11-20 05:02:11 +03:00
deriving Bounded
2015-11-20 05:02:21 +03:00
instance Enum Style where
fromEnum Normal = 0
fromEnum Bold = 1
fromEnum Underline = 4
toEnum 0 = Normal
toEnum 1 = Bold
toEnum 4 = Underline