cabal-helper- Give Haskell development tools access to Cabal project environment

Safe HaskellNone





findProjects :: FilePath -> IO [Ex ProjLoc] Source #

findProjects dir. Find available project instances in dir.

For example, if the given directory contains both a cabal.project and a stack.yaml file:

>>> findProjects "."
[ Ex (ProjLocStackYaml "./stack.yaml"), Ex (ProjLocCabalV2File "./cabal.project") ]

Note that this function only looks for "default" project markers. If you want to for example support the common pattern of having multiple stack-GHC_VER.yaml files simply fill out a ProjLoc yourself. In this case ProjLocStackYaml.

getDefaultDistDir :: ProjLoc pt -> DistDir pt Source #

getDefaultDistDir pl. Get the default dist-dir for the given project.

Note that the path in the returned dist-dir might not exist yet if the build-tool has never been run for this project before. This is fine as far as cabal-helper is concerned. It will simply invoke the build-tool as needed to answer the requested queries.

isValidDistDir :: DistDir pt -> IO (Maybe Bool) Source #

isValidDistDir distdir. Check if distdir looks like a valid build-dir for it's project type. We just check if characteristic marker files for the associated project type exist.

If the project type does not have a way to do this (for example DistDirStack) check we return Nothing.