What are possible values for the “os” function from the System.Info package in the Standard Libraries?
Also: Are these values reliable, are they portable across many compilers? Will Hugs on windows return the same value as ghc on windows?
Are there better ways for sniffing for the operating system?
The variables for GHC are taken from the “autotools” tool suite, the tool suite that produces the well-known “configure” scripts that are almost always used when compiling something (
./configure; make; make install).configureuses a standard “compiler identification string” likex86_64-unknown-linux-gnufor C compilers, and additionally computes a more detailed set of variables that identify the host platform. These variables are used in the generatedMakefileof GHC, and this file further produces theghcplatform.hfile you see in theInfo.hsfile.Almost the exact same procedure is used by HUGS to get the platform variables, except that the header file is named differently (as you are able to see in the source code that you linked).
Since both GHC and HUGS98 on Windows are compiled with MinGW and autotools as well, the variables are consistent on that platform.