Library proposal: Add System.Info.isWindows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Aug 6 08:18:36 EDT 2007


On Mon, 2007-08-06 at 11:26 +0100, Neil Mitchell wrote:

> Proposal:
> 
> Add System.Info.isWindows :: Bool
> 
> This value should return True on all Windows systems (Win 1.0 ...
> Vista), and False on all other systems.

How about something slightly more general but still not quite so free
form as the current System.Info.os :: String.

Ian just added something to Cabal for it's own internal use to clean up
the use of os-specific #cppery and use of System.Info.os which seems
reasonable to me:

data OS = Linux | Windows Windows | ... etc | Other String
data Windows = MingW

os :: OS


So it's easy to pattern match on it and it gives us the ability to be
more or less specific. For example in the windows case we could
distinguish the environment, native vs mingw vs cygwin.

That generalises isWindows and means we don't need isLinux, isOSX etc
etc. Or if people really want those they can define them in terms of the
above.

So I suggest this (or something like it) as an alternative.

While we're at it, discussing System.Info I think there are several more
useful things we could add there, like exeExtension and probably several
more. I seem to recall someone proposed a reasonable list on this
mailing list some time ago, not just obj and dllExtension but a slightly
wider rang of things. I can't seem to find it right now, does anyone
else remember?

Duncan



More information about the Libraries mailing list