Extensions and Cabal

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Mar 23 20:47:45 EDT 2007


On Fri, 2007-03-23 at 21:42 +0000, Neil Mitchell wrote:
> > 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!

So do I.

> > * 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.

That would be helpful.

See also Alexander Jacobson's recent email on this topic:

http://www.haskell.org/pipermail/haskell/2007-March/019265.html

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

Obviously it'd be easier on users / developers if Cabal could tell you
if you need to add extra allowed extensions that you're using. For that
we need to scan the .hs files, which probably means we need the full dep
analysis too.


Duncan



More information about the cabal-devel mailing list