Library proposal: Add System.Info.isWindows

Thomas Schilling nominolo at googlemail.com
Mon Aug 6 16:24:00 EDT 2007


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.

I am much for an ADT instead of an unstandardized String, but having  
a battery of is<OS> is not a solution -- a library/program should be  
able to decide for itself how much info about it's environment it  
needs.  (e.g., isWindows on cygwin depends really on what information  
you need, like for calling certain libraries, or just have a  
different UI style, etc.)

/ Thomas


More information about the Libraries mailing list