[Haskell-cafe] __GLASGOW_HASKELL__ macro in 7.2.1

Daniel Fischer daniel.is.fischer at googlemail.com
Fri Oct 14 17:13:16 CEST 2011


On Friday 14 October 2011, 16:47:45, JP Moresmau wrote:
> Hello list,
> I must be doing something stupid, but what?
> 
> ghc --version
> The Glorious Glasgow Haskell Compilation System, version 7.2.1
> 
> ghc -E -optP-dM -cpp Main.hs (per
> http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.h
> tml)
> 
> {-# LINE 1 "Main.hs" #-}
> #define mingw32_HOST_OS 1
> #define i386_BUILD_ARCH 1
> #define __GLASGOW_HASKELL__ 702
> #define __STDC_HOSTED__ 1
> #define i386_HOST_ARCH 1
> #define mingw32_BUILD_OS 1
> 
> I'm on Windows so everything else is correct except the line that
> tells me I'm using 7.0.2.

No, __GLASGOW_HASKELL__ == 702 means you're using ghc-7.2.*, not 7.0.2.

The second and third digit of the version are for the second component, so 
610 was 6.10.*, 612 was 6.12.*

> Unfortunately I have code that works under 7.0.3 and breaks under
> 7.2.1 (and the 7.2.1 code breaks under 7.0.3, of course) so I don't
> see anything other option than conditional compilation.

#in __GLASGOW_HASKELL__ >= 702
-- code for 7.2.1 and greater
#else
-- code for ghc <= 7.0.4
#endif





More information about the Haskell-Cafe mailing list