Cabal package description sytax

Simon Marlow simonmar at microsoft.com
Mon Nov 29 04:32:36 EST 2004


On 29 November 2004 06:50, isaac jones wrote:

> On 27 November 2004 14:04, Sven Panne wrote:
>
>>  especially the use of quotes. Some field
>> values can be quoted, others can't, but I can't see any general
>> principle here.
> 
> The principal is that if there are fields that contain multiple values
> and unpredictable syntax, then you can use quotes.  Maybe the only
> place that this is true is for file paths.  You may note that the
> example in the proposal has a comma.

In the version of Cabal in libraries/Cabal, I changed the parser to
allow quotes in more places.  I did it in an adhoc way (just fixing
problems as they arose), and I fully agree with Sven that we should be
more consistent about it.

I suggest: 

  - a field of type String allows Haskell lexical syntax for strings
    in addition to the field-specific syntax.

  - a field of type [String] (including [FilePath] and [Opt]) allows
    the elements to be Haskell lexical syntax strings, again in addition
    to the field-specific syntax.

  - PackageIdentifiers are allowed to be quoted, and similarly for
    Licenses and the Bool field (exposed).

That covers all of them, I think.

> I think I like this idea for the cabal package description, and it
> would definitely be good to have consistency between the public parts
> of HC-pkg and cabal's package description.
> 
> Unless anyone has objections to allowing quotes in all the fields, you
> should feel free to alter cabal's parser and send me a patch (it'll
> probably be a few days before I can do any serious cabal hacking).
> Since it's necessary for some fields, it'll probably simplify it if
> quotes are allowed everywhere.  Opinions anyone?
> 
> I'm not sure what this'll do when it dumps out a ghc-pkg description
> file, though, so some care should be taken (maybe that's what you're
> getting at above).

For simplicity the dumped InstalledPackageInfo can use quotes
everywhere.  To refine this, we'd have to check for the presence of
special characters, spaces etc. in the field values.

Cheers,
	Simon


More information about the Libraries mailing list