ghc-mod-3.0.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 option, as it would appear on the command line.

type Package = StringSource

Package names

type IncludeDir = FilePathSource

Include directories for modules

Cabal API

fromCabalFile :: [GHCOption] -> Cradle -> IO ([GHCOption], [IncludeDir], [Package])Source

Parsing a cabal file in Cradle and returns options for GHC, include directories for modules and package names of dependency.

parseCabalFile :: FilePath -> IO PackageDescriptionSource

Parsing a cabal file and returns PackageDescription. IOException is thrown if parsing fails.

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.

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 LogReaderSource

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.