[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:
http://github.com/batterseapower/ansi-terminal/tree/master/ansi-terminal.cabal.
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
(http://github.com/batterseapower/ansi-terminal/tree/master/System/Console/ANSI.hs)
which either imports System.Console.ANSI.Windows or
System.Console.ANSI.Unix depending on which of those two have been
defined.
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,
Max
More information about the Haskell-Cafe
mailing list