X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FInfo.hs;h=85b90177b5104a53e729995260578304de900c45;hb=ca6b0a3e29400e95514169cd2735768965be1396;hp=02cd45de0bd2506ed9b3077a4b1ff7696a3957de;hpb=3c52c938ecbf4c769d0dfcb310707149dcef1f93;p=ghc-base.git diff --git a/System/Info.hs b/System/Info.hs index 02cd45d..85b9017 100644 --- a/System/Info.hs +++ b/System/Info.hs @@ -13,20 +13,23 @@ -- ----------------------------------------------------------------------------- -#ifndef __NHC__ -#include "MachDeps.h" -#endif - module System.Info ( os, -- :: String - arch -- :: String + arch, -- :: String + compilerName, -- :: String +#ifdef __GLASGOW_HASKELL__ + compilerVersion -- :: Version +#endif ) where import Prelude +import Data.Version #ifndef __NHC__ +#include "ghcplatform.h" + arch :: String arch = HOST_ARCH @@ -37,3 +40,20 @@ os = HOST_OS os,arch ::String #include "OSInfo.hs" #endif + +compilerName :: String +#if defined(__NHC__) +compilerName = "nhc98" +#elif defined(__GLASGOW_HASKELL__) +compilerName = "ghc" +#elif defined(__HUGS__) +compilerName = "hugs" +#else +#error Unknown compiler name +#endif + +#ifdef __GLASGOW_HASKELL__ +compilerVersion :: Version +compilerVersion = Version {versionBranch=[maj,min], versionTags=[]} + where (maj,min) = __GLASGOW_HASKELL__ `divMod` 100 +#endif