I would like to conditionally expose a number of internal modules in a
library depending on a cabal flag - the idea is that new features
could be implemented externally to the library without contaminating
the source with undesirable changes.  However, I've been unable to
find a way to structure a cabal file that does not require repeating
the list of modules.  For example, this works:

  exposed-modules:
    Public.Stable.Module
  if flag(exposeInternals)
    exposed-modules:
       <long list of internal modules>
  else
    other-modules:
       <long list of internal modules, identical to above>

But I don't want to maintain two identical lists of modules in the cabal file.

I've tried putting the section headers in the if's, but this doesn't
appear to work (cabal doesn't complain, but the modules to be exposed
are not available as expected):

  exposed-modules:
    Public.Stable.Module
  if flag(exposeInternals) {
  exposed-modules:
  } else {
  other-modules:
  }
    <long list of internal modules>


Does anyone have suggestions?

Thanks!
Rogan

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to