Safe Haskell | None |
---|
Low level access to the ghc-mod library.
- type LogReader = IO [String]
- type GHCOption = String
- type Package = (PackageBaseName, Maybe String)
- type IncludeDir = FilePath
- data CompilerOptions = CompilerOptions {
- ghcOptions :: [GHCOption]
- includeDirs :: [IncludeDir]
- depPackages :: [Package]
- userPackageDbOptsForGhc :: Maybe FilePath -> [String]
- userPackageDbOptsForGhcPkg :: Maybe FilePath -> [String]
- parseCabalFile :: FilePath -> IO PackageDescription
- getCompilerOptions :: [GHCOption] -> Cradle -> PackageDescription -> IO CompilerOptions
- cabalAllBuildInfo :: PackageDescription -> [BuildInfo]
- cabalDependPackages :: [BuildInfo] -> [PackageBaseName]
- cabalSourceDirs :: [BuildInfo] -> [IncludeDir]
- cabalAllTargets :: PackageDescription -> IO ([String], [String], [String], [String])
- getSystemLibDir :: IO (Maybe FilePath)
- getDynamicFlags :: IO DynFlags
- initializeFlags :: GhcMonad m => Options -> m ()
- initializeFlagsWithCradle :: GhcMonad m => Options -> Cradle -> [GHCOption] -> Bool -> m (LogReader, Maybe PackageDescription)
- setTargetFiles :: GhcMonad m => [FilePath] -> m ()
- addTargetFiles :: GhcMonad m => [FilePath] -> m ()
- handleErrMsg :: LineSeparator -> SourceError -> Ghc [String]
- browseAll :: DynFlags -> Ghc [(String, String)]
- (||>) :: Ghc a -> Ghc a -> Ghc a
- goNext :: Ghc a
- runAnyOne :: [Ghc a] -> Ghc a
- (|||>) :: GhcMonad m => m a -> m a -> m a
Types
type IncludeDir = FilePathSource
An include directory for modules.
data CompilerOptions Source
Option information for GHC
CompilerOptions | |
|
Cradle
userPackageDbOptsForGhc :: Maybe FilePath -> [String]Source
Creating user package db options for GHC.
>>>
userPackageDbOptsForGhc (Just "/foo/bar/i386-osx-ghc-7.6.3-packages.conf.d")
["-no-user-package-db","-package-db","/foo/bar/i386-osx-ghc-7.6.3-packages.conf.d"]>>>
userPackageDbOptsForGhc (Just "/foo/bar/i386-osx-ghc-7.4.1-packages.conf.d")
["-no-user-package-conf","-package-conf","/foo/bar/i386-osx-ghc-7.4.1-packages.conf.d"]
userPackageDbOptsForGhcPkg :: Maybe FilePath -> [String]Source
Creating user package db options for ghc-pkg.
>>>
userPackageDbOptsForGhcPkg (Just "/foo/bar/i386-osx-ghc-7.6.3-packages.conf.d")
["--no-user-package-db","--package-db=/foo/bar/i386-osx-ghc-7.6.3-packages.conf.d"]>>>
userPackageDbOptsForGhcPkg (Just "/foo/bar/i386-osx-ghc-7.4.1-packages.conf.d")
["--no-user-package-conf","--package-conf=/foo/bar/i386-osx-ghc-7.4.1-packages.conf.d"]
Cabal API
parseCabalFile :: FilePath -> IO PackageDescriptionSource
Parsing a cabal file and returns PackageDescription
.
IOException
is thrown if parsing fails.
getCompilerOptions :: [GHCOption] -> Cradle -> PackageDescription -> IO CompilerOptionsSource
Getting necessary CompilerOptions
from three information sources.
cabalAllBuildInfo :: PackageDescription -> [BuildInfo]Source
Extracting all BuildInfo
for libraries, executables, and tests.
cabalDependPackages :: [BuildInfo] -> [PackageBaseName]Source
Extracting package names of dependency.
cabalSourceDirs :: [BuildInfo] -> [IncludeDir]Source
Extracting include directories for modules.
cabalAllTargets :: PackageDescription -> IO ([String], [String], [String], [String])Source
Extracting all Module
FilePath
s for libraries, executables,
tests and benchmarks.
IO
getSystemLibDir :: IO (Maybe FilePath)Source
Obtaining the directory for system libraries.
getDynamicFlags :: IO DynFlagsSource
Return the DynFlags
currently in use in the GHC session.
Initializing DynFlags
initializeFlags :: GhcMonad m => Options -> m ()Source
Initialize the DynFlags
relating to the compilation of a single
file or GHC session.
initializeFlagsWithCradle :: GhcMonad m => Options -> Cradle -> [GHCOption] -> Bool -> m (LogReader, Maybe PackageDescription)Source
Ghc
Monad
setTargetFiles :: GhcMonad m => [FilePath] -> m ()Source
Set the files that GHC will load / compile.
addTargetFiles :: GhcMonad m => [FilePath] -> m ()Source
Adding the files to the targets.
handleErrMsg :: LineSeparator -> SourceError -> Ghc [String]Source
Converting SourceError
to String
.
browseAll :: DynFlags -> Ghc [(String, String)]Source
Browsing all functions in all system/user modules.
Ghc
Choice
(||>) :: Ghc a -> Ghc a -> Ghc aSource
Try the left Ghc
action. If IOException
occurs, try
the right Ghc
action.