System.Info now exports:
compilerName :: String
compilerVersion :: Data.Version.Version
as requested ages ago by Template Haskell users. This allows
"conditional compilation" based on the GHC version in TH code.
I've implemented compilerName for all compilers (I hope). Other
compiler vendors are encouraged to provide their own implementations
of compilerVersion.
os, -- :: String
arch, -- :: String
compilerName, -- :: String
+#ifdef __GLASGOW_HASKELL__
compilerVersion -- :: Version
+#endif
) where
import Prelude
#error Unknown compiler name
#endif
-compilerVersion :: Version
#ifdef __GLASGOW_HASKELL__
+compilerVersion :: Version
compilerVersion = Version {versionBranch=[maj,min], versionTags=[]}
where (maj,min) = __GLASGOW_HASKELL__ `divMod` 100
#endif