ghc-mod-3.1.2: Happy Haskell Programming

Safe HaskellNone

Language.Haskell.GhcMod.Internal

Contents

Description

Low level access to the ghc-mod library.

Synopsis

Types

type LogReader = IO [String]Source

A means to read the log.

type GHCOption = StringSource

A single GHC command line option.

type Package = StringSource

A package name.

type IncludeDir = FilePathSource

An include directory for modules.

data CompilerOptions Source

Option information for GHC

Constructors

CompilerOptions 

Fields

ghcOptions :: [GHCOption]

Command line options

includeDirs :: [IncludeDir]

Include directories for modules

depPackages :: [Package]

Dependent package names

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, tests and benchmarks.

cabalDependPackages :: [BuildInfo] -> [Package]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 FilePaths for libraries, executables, tests and benchmarks.

GHC API

canCheckFast :: ModuleGraph -> BoolSource

Checking if Template Haskell or quasi quotes are used. If not, the process can be faster.

Getting DynFlags

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

Initialize the DynFlags relating to the compilation of a single file or GHC session according to the Cradle and Options provided.

GhcMonad

setTargetFiles :: GhcMonad m => [FilePath] -> m ()Source

Set the files that GHC will load / compile.

checkSlowAndSet :: GhcMonad m => m ()Source

To check TH, a session module graph is necessary. load sets a session module graph using depanal. But we have to set -fno-code to DynFlags before load. So, this is necessary redundancy.

Ghc Choice

(||>) :: Ghc a -> Ghc a -> Ghc aSource

Try the left Ghc action. If IOException occurs, try the right Ghc action.

goNext :: Ghc aSource

Go to the next Ghc monad by throwing AltGhcgoNext.

runAnyOne :: [Ghc a] -> Ghc aSource

Run any one Ghc monad.

GhcMonad Choice

(|||>) :: GhcMonad m => m a -> m a -> m aSource

Try the left GhcMonad action. If IOException occurs, try the right GhcMonad action.