haskell-cafe@haskell.org
[Top] [All Lists]

Re: [Haskell-cafe] Windows console

Subject: Re: [Haskell-cafe] Windows console
From: Andrew Coppin
Date: Sat, 13 Sep 2008 13:41:17 +0100
Max Bolingbroke wrote:
2008/9/13 Andrew Coppin <andrewcoppin@xxxxxxxxxxxxxx>:
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.

[rejoyce!]

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
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.

Hmm, I wasn't aware you could use the C preprocessor on Haskell source code. That could be rather useful, e.g., for adding or removing debug code.

Anyway, that still leaves one question: how do you figure out which platform you're on so you can set the right options?

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>