libhbb-0.4.1.0: Backend for text editors to provide better Haskell editing support.

Safe HaskellNone

Language.Haskell.HBB.Internal.GHC

Synopsis

Documentation

runGhcWithCmdLineFlags :: [String] -> Maybe FilePath -> Ghc a -> IO aSource

This is a wrapper around runGhc which allows to pass some command line options.

This function takes ghc-specific command line flags and inserts them into the GHC monad. The passed Ghc action is then executed in an environment where these flags have been applied. Principally there are 3 types of flags for GHC:

  • dynamic flags
  • static flags (they may change during one compiler run)
  • mode flags (e.g. --make)

This function only processes dynamic and static flags. They should be passed as specified on the command line:

 runGhcWithCmdLineFlags [-isrc,-XDeriveDataTypeable] (Just libdir) someAction

This function will throw an exception if any of the specified options leads to a warning or cannot be parsed.

extractRenamedAST :: GhcMonad m => ModSummary -> m RenamedSourceSource

Takes a module summary and returnes the renamed abstract syntax tree.

This is a small auxiliary function that takes a module summary and extracts the renamed abstract syntax tree from it. The syntax tree is represented by the data structure HsGroup in GHC.

updateDynFlagsToSuppressFileOutput :: GhcMonad m => m ()Source

A small auxiliary function that updates the dynamic flags to suppress file output.

searchModGraphFor :: GhcMonad m => Either FilePath Module -> m (ModuleName, ModSummary)Source

This function takes a file name or a module and searches the module-summary which is based on this source file out of the module graph.

fileToTarget :: FilePath -> TargetSource

This function creates a target from the passed file name by applying to most common used settings.

loadTargetsFromFilename :: GhcMonad m => FilePath -> m ()Source

Wrapper around setTargets and load that treats the common case of a one-file-target.