Language extensions - backwards compatibility

Iain Alexander ia at
Thu Jan 28 18:38:27 EST 2010

I'm looking for a way of specifying language extensions in a way which will 
work in all versions of GHC from 6.4 onwards.  

GHC 6.4 does not support the LANGUAGE pragma.  Specifying language options in 
the OPTIONS_GHC pragma starts to produce deprecation warnings in 6.10, and will 
presumably eventually fail altogether.  

Any sort of preprocessing at the beginning of a file appears to insert enough 
noise to inhibit recognition of file-header pragmas. (Cpphs doesn't appear to 
help here.) Attempting preprocessing inside a leading OPTIONS_GHC pragma fails 
because it apparently attempts to interpret the pragma *before* invoking the 

The only remaining option I can see is to have a completely separate version of 
the file for GHC 6.4.  Have I missed anything?  
Iain Alexander      ia at

More information about the Glasgow-haskell-users mailing list