Version 7 (modified by nominolo, 6 years ago)

2007-05-30 progress report

Cabal Configurations Progress

On this page I (Thomas Schilling) will document some of the design decisions and my progress on implementing Cabal configurations. If you have any questions ping me on #haskell or send a mail to me or, better, the cabal-devel mailing list. My nickname is "nominolo", my email is <my_nickname> at google.com.

I am working mostly based on the  latest proposal.

.cabal Syntax

Since configs require incompatible changes to the module syntax we now require [or not. There might be a simple way to keep backwards compatibility.]

Cabal-version: >= 1.1.7

[The following should probably be discussed]

Additionally, packages now require a block-structured syntax, e.g.,

Cabal-version:  >= 1.1.7
Name:           TestPackage
Version:        0.0
License:        BSD3
Author:         Angela Author
Synopsis:       Small package with two programs

flag: fps_in_base
description: Use a base library that contains fps

flag: debug
description: Show debugging information
default: false

Library {
  if flag(fps_in_base) {
    build-depends: base >= 2
  } else {
    build-depends: base < 2, fps >= 0.8
  }

  if flag(debug) && os(windows) {
    cpp-options: -DDEBUG_WINDOWS_STUFF
  }
}

Executable: program1 {
  Main-Is:        Main.hs
  Hs-Source-Dirs: prog1
}

Executable: program2 {
  Main-Is:        Main.hs
  Hs-Source-Dirs: prog2
  Other-Modules:  Utils
}

Progress Log

2007-05-30:

Started modifying the higher levels of the parsing code to incorporate support for conditions. Lot's of cleaning up required. This is when you learn the merits of XML.

2007-05-29:

Not much hacking today; had exam. Parsing and simplifying conditions works.

2007-05-28:

Low-level parsing works. We now have three syntactic categories:

  • Normal properties: fieldname: value
  • If-blocks: 'if' condition '{' ... '}' ['else' '{' ... '}']
  • Sections: sectionname sectionlabel '{' ... '}' where sectionname can currently be only library or executable. Whether or not a label is required is checked at a higher level.

This scheme is backwards compatible. I plan to add a warning when blocks are used but no Cabal-version: > 1.1.7 or equivalent is present.