Library proposal: Add System.Info.isWindows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Aug 15 10:28:19 EDT 2007


We have not reached consensus on this issue yet.

Based on informal chats with interested people, here is another concrete
proposal:

Instead of adding isWindows, isBeOS, isNixOS etc we have a simple
enumeration of the major OS flavour:

data OSFlavour = Linux | Windows | MacOS | BSD | Solaris | Other String

osFlavour :: OSFlavour

So no "subsystem" as fields of the OS constructors.

This keeps it simple and covers many use cases.

Adding more specific feature tests would probably cover most of the
other use cases where we need more information than we can divine from
the OS kind.

So if people want isWindows or isUnixish predicates they can implement
them easily in terms of this enumeration. This avoids us having to
centrally agree an interpretation of what isUnixish might mean (so no
arguments about whether ghc built to target cygwin is sufficiently
unixish).


If people feel it is really necessary, a separate build platform string
could be added. This would be the system/platform/toolchain that the
compiler targets:

compilerBuild :: String

eg for GHC on windows this would be "mingw32", "cygwin" or whatever.

But I wonder if that's really necessary and if whatever people are
testing on the basis of the build flavour couldn't be decided better
with more specific feature tests.

So I'd advocate a simple coarse OS classification and additional
specific feature tests.

Duncan



More information about the Libraries mailing list