Library proposal: Add System.Info.isWindows

John Meacham john at
Mon Aug 6 18:09:19 EDT 2007

On Mon, Aug 06, 2007 at 06:04:41PM -0300, Isaac Dupree wrote:
> Thomas Schilling wrote:
> >On 6 aug 2007, at 12.26, Neil Mitchell wrote:
> >>.... = os == "mingw"
> >>
> >>This is wrong on so many levels!
> >
> >I agree, but
> >
> >>Proposal:
> >>
> >>Add System.Info.isWindows :: Bool
> >
> >is hardly better, because this opens the door to political issues (why 
> >not have isLinux, isFreeBSD, isNetBSD, ...?)  And I'm not even sure 
> >returning True for every Windows incarnation is the right thing in most 
> >use cases.  In general you want to test for APIs--not the OS per se.
> Like it or not, Windows is a very significant, special case, where 
> programs often transform themselves, more than they need to, based on a 
> simple judgment of whether they're on "windows" or not, even when POSIX 
> APIs are available, etc., etc.  ***I don't like it either.***  But 
> defining APIs is hard work, Windows is in practice much different from 
> almost anything else, much more important, and many of us aren't 
> interested in expending too much hard work to support (flexibly, in 
> detail,) stupid closed-source platforms.  Developers tend to want to 
> check for isWindows anyway: they already do, with os=="mingw" and other 
> hacks.  ***I think isWindows is necessary, at least as a intermediate 
> solution***... if someone makes more, API-specific queries sometime, 
> then it will be easier to search existing code for the unified 
> "isWindows" and find everywhere that might be improved.

Yes. I agree, I wouldn't want to see an enumerated data type, because
you really want to query features the environment supports, not
necessarily what OS. (like, ReactOS provides the win32 api)

so, I'd actually like to see two

isWindows :: Bool
isPosix :: Bool

where they say whether the given APIs are available (to some reasonable

for instance, windows under mingw would be True,False, while windows
under cygwin would be True,True and linux would be False,True.

This covers the 'special' cases that most people have to worry about. 

I have nothing against a more complete API, but these two special cases
are common and important enough that I think they should have special


John Meacham - ⑆⑆john⑈

More information about the Libraries mailing list