[Haskell-cafe] Windows console

Max Bolingbroke batterseapower at hotmail.com
Sat Sep 13 08:03:39 EDT 2008

2008/9/13 Andrew Coppin <andrewcoppin at btinternet.com>:
>> Just FYI, I have now implemented and tested this feature. The new
>> version, 0.5.0, is available on Hackage.
> For both platforms?

Of course! My package promises to work cross-platform, after all.

> Out of interest, how do you get the correct package built on each platform?

If you mean "how do I compile the ANSI emulator on Windows but the
actual ANSI stuff on Unix", most of the magic is in the .cabal file:
I simply turn on the C-preprocessor (CPP) and then supply -DWINDOWS on
Windows and -DUNIX on anything else. The actual use of CPP in my
source is then confined to a single module
which either imports System.Console.ANSI.Windows or
System.Console.ANSI.Unix depending on which of those two have been

Nothing to it, really. However, this is the stuff that is making the
Hackage documentation generation choke currently because until
recently Cabal forgot to supply the CPP flags to a Haddock 2 (but not
Haddock 0.x) run.

All the best,

More information about the Haskell-Cafe mailing list