ghc-mod-5.6.0.0: Happy Haskell Programming

Safe Haskell | None
Language | Haskell2010

Language.Haskell.GhcMod.PathsAndFiles

Synopsis

- type DirPath = FilePath
- type FileName = String
- newtype UnString = UnString {
  - unString :: String
  }
- findCabalFile :: FilePath -> IO (Maybe FilePath)
- findStackConfigFile :: FilePath -> IO (Maybe FilePath)
- getSandboxDb :: Cradle -> IO (Maybe GhcPkgDb)
- extractSandboxDbDir :: String -> Maybe FilePath
- isCabalFile :: FilePath -> Bool
- takeExtension' :: FilePath -> String
- findFileInParentsP :: (FilePath -> Bool) -> FilePath -> IO [(DirPath, [FileName])]
- getFilesP :: (FilePath -> Bool) -> DirPath -> IO [FileName]
- findCabalSandboxDir :: FilePath -> IO (Maybe FilePath)
- zipMapM :: Monad m => (a -> m c) -> [a] -> m [(a, c)]
- parents :: FilePath -> [FilePath]
- setupConfigFile :: Cradle -> FilePath
- sandboxConfigFile :: Cradle -> FilePath
- sandboxConfigFileName :: String
- setupConfigPath :: FilePath -> FilePath
- macrosHeaderPath :: FilePath
- autogenModulePath :: String -> String
- autogenModulesDir :: FilePath
- ghcSandboxPkgDbDir :: String -> String
- packageCache :: String
- symbolCache :: Cradle -> FilePath
- symbolCacheFile :: String
- resolvedComponentsCacheFile :: FilePath -> FilePath
- cabalHelperCacheFile :: FilePath -> FilePath
- mergedPkgOptsCacheFile :: FilePath -> FilePath
- pkgDbStackCacheFile :: FilePath -> FilePath
- findCustomPackageDbFile :: FilePath -> IO (Maybe FilePath)
- module Language.Haskell.GhcMod.Caching

# Documentation

type DirPath = FilePath #

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

type FileName = String #

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

newtype UnString #

Constructors

UnString |
Fields unString :: String

Instances

Read UnString # |
Methods readsPrec :: Int -> ReadS UnString # readList :: ReadS [UnString] # readPrec :: ReadPrec UnString # readListPrec :: ReadPrec [UnString] #
Show UnString # |
Methods showsPrec :: Int -> UnString -> ShowS # show :: UnString -> String # showList :: [UnString] -> ShowS #

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

`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`

findStackConfigFile :: FilePath -> IO (Maybe FilePath) #

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

Get path to sandbox config file

extractSandboxDbDir :: String -> Maybe FilePath #

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 #

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

takeExtension' :: FilePath -> String #

    >>> 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])] #

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

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

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

findCabalSandboxDir :: FilePath -> IO (Maybe FilePath) #

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

parents :: FilePath -> [FilePath] #

`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"]

setupConfigFile :: Cradle -> FilePath #

sandboxConfigFile :: Cradle -> FilePath #

sandboxConfigFileName :: String #

setupConfigPath :: FilePath -> FilePath #

Path to `LocalBuildInfo` file, usually `dist/setup-config`

macrosHeaderPath :: FilePath #

autogenModulePath :: String -> String #

autogenModulesDir :: FilePath #

ghcSandboxPkgDbDir :: String -> String #

packageCache :: String #

symbolCache :: Cradle -> FilePath #

Filename of the symbol table cache file.

symbolCacheFile :: String #

resolvedComponentsCacheFile :: FilePath -> FilePath #

cabalHelperCacheFile :: FilePath -> FilePath #

mergedPkgOptsCacheFile :: FilePath -> FilePath #

pkgDbStackCacheFile :: FilePath -> FilePath #

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

`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`

module Language.Haskell.GhcMod.Caching