Library proposal: Add System.Info.isWindows
isaacdupree at charter.net
Mon Aug 6 17:04:41 EDT 2007
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
>> 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.
I vote *against* the name isMicrosoftWindows because the query *should*
return True in ReactOS / Wine, assuming Haskell and them can be made to
work at all! Any differences there, should be resolved by more detailed
queries (e.g. Window OS version number! - or whatever they use for
labelling their versions)
More information about the Libraries