February 4, 2011
ghc-ansi-terminal, ANSI terminal support for Haskell is now available for Fedora. It allows cursor movement, clearing the screen, coloured output, showing or hiding the cursor, and setting the title.
$ sudo yum install ghc-ansi-terminal ghc-ansi-terminal-devel
An example code, ansi.hs is given below:
import System.Console.ANSI
main = do
setCursorPosition 5 0
setTitle "ANSI Terminal Short Example"
setSGR [ SetConsoleIntensity BoldIntensity
, SetColor Foreground Vivid Red
]
putStr "Hello"
setSGR [ SetConsoleIntensity NormalIntensity
, SetColor Foreground Vivid White
, SetColor Background Dull Blue
]
putStrLn "World!"
A screenshot of the output when the above code is executed: