Go to the first, previous, next, last section, table of contents.

Backwards compatibility: Converting from GHC 0.xx and Haskell 1.2

This part of the guide is to help people upgrading from a previous version of GHC. Right now, it is mostly to help people switching from GHC 0.29 (a Haskell 1.2 compiler, mostly) to GHC 2.xx (a Haskell 1.4 compiler). If you need to maintain Haskell code that will work for multiple versions of GHC, you can use the `-cpp' flag and the `__GLASGOW_HASKELL__' pre-processor variable. For example, in GHC 0.29, `__GLASGOW_HASKELL__' will be 29; for 2.04, it will be 204. Thus, you can write:
#if __HASKELL1__ <= 2
main = appendChan stdout "Hello, world!\n" exit done -- 1.2
#else
# if __GLASGOW_HASKELL__ >= 200
import IO
main = putStr "Hello, world!"   -- real 1.3
# else
main = putStr "Hello, world!\n" -- pseudo-1.3 in 0.2x
# endif
#endif

Go to the first, previous, next, last section, table of contents.