X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FInfo.hs;h=dfb30188d43590a92f326d21c848a1110ae44519;hb=ec3ba94b254bd444e7a1c560c1d91c4879948c69;hp=02cd45de0bd2506ed9b3077a4b1ff7696a3957de;hpb=7d469fba03085e1538f7b33227a3b69fc68d037f;p=ghc-base.git diff --git a/System/Info.hs b/System/Info.hs index 02cd45d..dfb3018 100644 --- a/System/Info.hs +++ b/System/Info.hs @@ -13,20 +13,21 @@ -- ----------------------------------------------------------------------------- -#ifndef __NHC__ -#include "MachDeps.h" -#endif - module System.Info ( os, -- :: String - arch -- :: String + arch, -- :: String + compilerName, -- :: String + compilerVersion -- :: Version ) where import Prelude +import Data.Version #ifndef __NHC__ +#include "ghcplatform.h" + arch :: String arch = HOST_ARCH @@ -37,3 +38,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 + +compilerVersion :: Version +#ifdef __GLASGOW_HASKELL__ +compilerVersion = Version {versionBranch=[maj,min], versionTags=[]} + where (maj,min) = __GLASGOW_HASKELL__ `divMod` 100 +#endif