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

25 lines
517 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"