Library proposal: Add System.Info.isWindows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Aug 15 20:03:22 EDT 2007


On Wed, 2007-08-15 at 17:38 -0300, Isaac Dupree wrote:
> 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"

Yes, good point. Another point for osType :: OSType  in my opinion :-)

> 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)

Since nobody uses it, we don't need to distinguish it :-)

> 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 :)

The person who ports a Haskell implementation to an OS that isn't
covered by the existing enumeration can add a new value to the
enumeration and include that in their port and get it included in the
current base package.

> 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??

Mm, that's an interesting point, perhaps the string isn't necessary.

Duncan



More information about the Libraries mailing list