
Hi Jakob, you might like the cabal-lenses[1] library. Getting 'hs-source-dirs' from all sections of the cabal file (library, executable, ...) and evaluating the conditionals in the cabal file (considering the default value of flags and the current platform), you should be able to write: import Control.Lens -- from the lens library import CabalLenses -- from the cabal-lenses library hsSourceDirs :: GenericPackageDescription -> [String] hsSourceDirs pkgDesc = pkgDesc ^.. allBuildInfo . traversed . hsSourceDirsL You can also specify[2] which section you like to read or how flags for the conditionals should be set. If you only need a command line programming for the reading of 'hs-source-dirs', then there's cabal-cargs[3]. The above example: cabal-cargs --only=hs_source_dirs --format=pure Greetings, Daniel [1] https://hackage.haskell.org/package/cabal-lenses-0.4.7 [2] https://hackage.haskell.org/package/cabal-lenses-0.4.5/docs/CabalLenses-Trav... [3] https://hackage.haskell.org/package/cabal-cargs