
I'm trying to use the Cabal api to preprocess a .cabal file and have it run the preprocessors. But preprocessSources takes a PackageDescription (which I get from a GenericPackageDescription) so this does not contain any information on the Executables or Libraries in the cabal file. So nothing gets executed. What is the correct way to use it? For reference, my code is preprocessPackage :: Context -> String -> IO () preprocessPackage env file = do info <- maybeGetPersistBuildConfig configName outdated <- case info of Just i -> safeCheckPersistBuildConfig "dist" file Nothing -> return True pkg_info <- case outdated of False -> return $ fromJust info True -> do new_info <- configurePackage env writePersistBuildConfig configName new_info return new_info withContext env (\cfg -> preprocessSources (packageDescription cfg) pkg_info False deafening knownSuffixHandlers)