Extensions and Cabal

Neil Mitchell ndmitchell at gmail.com
Fri Mar 23 17:42:36 EDT 2007


> 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?

I like it!

> * If you want to load one of the modules in ghci, say, then you need to
>   tell it what flags to use.

I think this is the killer reason.

Another reason that you don't mention is that it discourages the use
of extensions, not massively, but slightly. Now if you want to use a
particular extension lots you must specify it in every single file.



More information about the cabal-devel mailing list