ANSI terminal support for Haskell: allows cursor movement, screen clearing, color output showing or hiding the cursor, and
changing the title. Compatible with Windows and those Unixes with ANSI terminals, but only GHC is supported as a compiler.

ansi-terminal

Description

Changing the console title (though this is not strictly part of
ANSI, it is widely supported in Unix)

It is compatible with Windows (via an emulation layer) and those Unixes
with ANSI terminals.

If you like this, you may be interested in
ansi-wl-pprint, which
provides a pretty-printer that can construct strings containing ANSI
colorisation.

Not all of the ANSI escape codes are provided by this module, but most
(if not all) of the popular and well supported ones are. For a full
list, have a look at the current version of the
API.
Each supported escape code or family of codes has a corresponding
function that comes in three variants:

A straight IO variant that doesn't take a Handle and just
applies the ANSI escape code to the terminal attached to stdout

An IO variant similar to above, but which takes a Handle to
which the ANSI escape should be applied

A String variant that returns a literal string that should be
included to get the effect of the code. This is the only one of the
three API variants that only works on Unix-like operating systems:
on Windows these strings will always be blank!

Example

A full example is
available,
but for a taste of how the library works try the following code: