
On Sat, Mar 24, 2007 at 10:53:54PM +0000, Samuel Bronson wrote:
Ian Lynagh
writes: Thus I propose that the .cabal file actually specifies what extensions the modules are /allowed/ to use, but does not actually enable them. They would then be enabled by LANGUAGE pragmas in the modules as necessary. So, if the .cabal file says "Extensions: E, F" then the modules will be compiled with --no-extension-flags --allowed-extension=E,F and if a module has "{-# LANGUAGE E #-}" then only extension E would be enabled for that module. If a module has "{-# LANGUAGE E,G #-}" then compilation would fail as extension G is not permitted.
Any comments? Criticisms? Flames?
The only thing I can think of (besides "nice idea") is that you'd better either a) make sure that Cabal always knows about all the extensions supported by the compiler or b) provide a workaround for when Cabal does not know about a given extension.
That's the --language=E flag in the paragraph beginning "2 and 4". But actually, Cabal would no longer enable extensions with this flag anyway, it would just list the extensions after the --allowed-extension flag (and it doesn't need to recognise them to list them). Thanks Ian