ghc-mod-5.5.0.0: Happy Haskell Programming

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.GhcMod.PathsAndFiles

Synopsis

Documentation

type DirPath = FilePath Source

Guaranteed to be a path to a directory with no trailing slash.

type FileName = String Source

Guaranteed to be the name of a file only (no slashes).

newtype UnString Source

Constructors

UnString 

Fields

unString :: String
 

findCabalFile :: FilePath -> IO (Maybe FilePath) Source

findCabalFiles dir. Searches for a .cabal files in dir's parent directories. The first parent directory containing more than one cabal file is assumed to be the project directory. If only one cabal file exists in this directory it is returned otherwise findCabalFiles throws GMENoCabalFile or GMETooManyCabalFiles

getSandboxDb :: Cradle -> IO (Maybe GhcPkgDb) Source

Get path to sandbox config file

extractSandboxDbDir :: String -> Maybe FilePath Source

Extract the sandbox package db directory from the cabal.sandbox.config file. Exception is thrown if the sandbox config file is broken.

isCabalFile :: FilePath -> Bool Source

>>> isCabalFile "/home/user/.cabal"
False

takeExtension' :: FilePath -> String Source

>>> takeExtension' "/some/dir/bla.cabal"
".cabal"
>>> takeExtension' "some/reldir/bla.cabal"
".cabal"
>>> takeExtension' "bla.cabal"
".cabal"
>>> takeExtension' ".cabal"
""

findFileInParentsP :: (FilePath -> Bool) -> FilePath -> IO [(DirPath, [FileName])] Source

findFileInParentsP p dir Look for files satisfying p in dir and all it's parent directories.

getFilesP :: (FilePath -> Bool) -> DirPath -> IO [FileName] Source

getFilesP p dir. Find all files satisfying p in .cabal in dir.

zipMapM :: Monad m => (a -> m c) -> [a] -> m [(a, c)] Source

parents :: FilePath -> [FilePath] Source

parents dir. Returns all parent directories of dir including dir.

Examples

>>> parents "foo"
["foo"]
>>> parents "/foo"
["/foo","/"]
>>> parents "/foo/bar"
["/foo/bar","/foo","/"]
>>> parents "foo/bar"
["foo/bar","foo"]

setupConfigPath :: FilePath -> FilePath Source

Path to LocalBuildInfo file, usually dist/setup-config

symbolCache :: Cradle -> FilePath Source

Filename of the symbol table cache file.

findCustomPackageDbFile :: FilePath -> IO (Maybe FilePath) Source

findCustomPackageDbFile dir. Searches for a ghc-mod.package-db-stack file in dir. If it exists in the given directory it is returned otherwise findCradleFile returns Nothing