Library proposal: Add System.Info.isWindows
Isaac Dupree
isaacdupree at charter.net
Wed Aug 15 16:38:10 EDT 2007
Duncan Coutts wrote:
> 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
test like (osFlavour == Windows)
note some people may try to spell it as "osFlavor"
MacOSX is completely different architecturally than the pre-X Mac OS
(the latter of which, practically no one tries to support anymore, but
at least _used to_ be worth mentioning in enumerations)
Plain Solaris is rather different than Solaris spammed with GNU
utilities etc... in the Unix world, OS's are not always so clear - but
the core, kernel, stuff makes it clear as far as I'm aware of, and the
rest is where particular feature tests are used. I suspect that people
too often assume that the same features are available on all unixes,
given how common it is to break on some of them. The common feature-set
will likely be provided by haskell libraries anyway (in which case the
libraries have to decide how to implement on each platform... okay)
I don't like the way that enumeration scheme interacts with new OS's.
What happens when/if Hurd or ReactOS or who-knows-what become viable
OSes. Are they different enough from the other OSes that they should go
in Other or (breakingly for any code that tries to detect it) be added
to the enumeration? Seems to make an "isUnixLike" difficult to
implement in terms of it... unless it's a feature test :)
None of the existing OSes get subtypes... what if "Other" is also
standalone, not having a String argument (and whenever someone wants to
detect some other OS, I guess they petition to have the enumeration
expanded and it will be promptly) - how is that on the problem scale??
It's a difficult question, taken generally. In some cases a
haskell-program-user may even want to specify how to treat their
environment (cygwin comes to mind). If only there was a decent package
system- but I digress,
Isaac
More information about the Libraries
mailing list