haskell-language-server-2.12.0.0: LSP server for GHC
Safe HaskellNone
LanguageGHC2021

Ide.Plugin.Cabal.Files

Synopsis

Documentation

findResponsibleCabalFile :: FilePath -> IO (Maybe FilePath) Source #

Given a path to a haskell file, returns the closest cabal file. If a package.yaml is present in same directory as the .cabal file, returns nothing, because adding a dependency to a generated cabal file will break propagation of changes from package.yaml to cabal files in stack projects. If cabal file wasn't found, returns Nothing.

readCabalFile :: forall (m :: Type -> Type). MonadIO m => FilePath -> ExceptT PluginError m ByteString Source #

Gives a cabal file's contents or throws error.

Inspired by readCabalFile in cabal-add, Distribution.Client.Main

This is a fallback option! Use only if the GetFileContents fails.