| Safe Haskell | None |
|---|
Language.Haskell.GhcMod
Description
The ghc-mod library.
- data Cradle = Cradle {}
- findCradle :: IO Cradle
- data Options = Options {
- outputStyle :: OutputStyle
- hlintOpts :: [String]
- ghcUserOptions :: [GHCOption]
- operators :: Bool
- detailed :: Bool
- qualified :: Bool
- lineSeparator :: LineSeparator
- newtype LineSeparator = LineSeparator String
- data OutputStyle
- = LispStyle
- | PlainStyle
- defaultOptions :: Options
- type ModuleString = String
- type Expression = String
- data GhcPkgDb
- type Symbol = String
- data SymbolDb
- data GhcModError
- data GhcModT m a
- type IOish m = (Functor m, MonadIO m, MonadBaseControl IO m)
- runGhcModT :: IOish m => Options -> GhcModT m a -> m (Either GhcModError a, GhcModLog)
- withOptions :: IOish m => (Options -> Options) -> GhcModT m a -> GhcModT m a
- boot :: IOish m => GhcModT m String
- browse :: IOish m => ModuleString -> GhcModT m String
- check :: IOish m => [FilePath] -> GhcModT m (Either String String)
- checkSyntax :: IOish m => [FilePath] -> GhcModT m String
- debugInfo :: IOish m => GhcModT m String
- expandTemplate :: IOish m => [FilePath] -> GhcModT m String
- info :: IOish m => FilePath -> Expression -> GhcModT m String
- lint :: IOish m => FilePath -> GhcModT m String
- pkgDoc :: IOish m => String -> GhcModT m String
- rootInfo :: IOish m => GhcModT m String
- types :: IOish m => FilePath -> Int -> Int -> GhcModT m String
- splits :: IOish m => FilePath -> Int -> Int -> GhcModT m String
- sig :: IOish m => FilePath -> Int -> Int -> GhcModT m String
- refine :: IOish m => FilePath -> Int -> Int -> Expression -> GhcModT m String
- auto :: IOish m => FilePath -> Int -> Int -> GhcModT m String
- modules :: IOish m => GhcModT m String
- languages :: IOish m => GhcModT m String
- flags :: IOish m => GhcModT m String
- findSymbol :: IOish m => Symbol -> GhcModT m String
- lookupSymbol :: IOish m => Symbol -> SymbolDb -> GhcModT m String
- dumpSymbol :: IOish m => GhcModT m String
- loadSymbolDb :: IO SymbolDb
Cradle
The environment where this library is used.
Constructors
| Cradle | |
Fields
| |
Finding Cradle.
Find a cabal file by tracing ancestor directories.
Find a sandbox according to a cabal sandbox config
in a cabal directory.
Options
Constructors
| Options | |
Fields
| |
newtype LineSeparator Source
The type for line separator. Historically, a Null string is used.
Constructors
| LineSeparator String |
data OutputStyle Source
Output style.
Constructors
| LispStyle | S expression style. |
| PlainStyle | Plain textstyle. |
defaultOptions :: OptionsSource
A default Options.
Types
type ModuleString = StringSource
Module name.
type Expression = StringSource
Haskell expression.
data GhcModError Source
Constructors
| GMENoMsg | Unknown error |
| GMEString | Some Error with a message. These are produced mostly by
|
| GMECabalConfigure | Configuring a cabal project failed. |
Instances
Monad Types
The GhcMod monad transformer data type. This is basically a newtype wrapper
around StateT, ErrorT, JournalT and ReaderT with custom instances for
GhcMonad and it's constraints.
The inner monad should have instances for MonadIO and MonadBaseControl
IO. Most mtl monads already have MonadBaseControl IO instances, see
the monad-control package.
Instances
| MonadTrans GhcModT | |
| MonadBaseControl IO m => MonadBase IO (GhcModT m) | |
| MonadBaseControl IO m => MonadBaseControl IO (GhcModT m) | |
| Monad m => MonadError GhcModError (GhcModT m) | |
| Monad m => MonadReader GhcModEnv (GhcModT m) | |
| MonadState s m => MonadState s (GhcModT m) | |
| MonadWriter w m => MonadWriter w (GhcModT m) | |
| Monad m => Monad (GhcModT m) | |
| Functor m => Functor (GhcModT m) | |
| Monad m => MonadPlus (GhcModT m) | |
| (Monad m, Functor m) => Applicative (GhcModT m) | |
| (Monad m, Functor m) => Alternative (GhcModT m) | |
| (Functor m, MonadIO m, MonadBaseControl IO m) => GhcMonad (GhcModT m) | |
| (Functor m, MonadIO m, MonadBaseControl IO m) => HasDynFlags (GhcModT m) | |
| (MonadIO m, MonadBaseControl IO m) => ExceptionMonad (GhcModT m) | |
| MonadIO m => MonadIO (GhcModT m) | |
| MonadIO m => MonadIO (GhcModT m) |
type IOish m = (Functor m, MonadIO m, MonadBaseControl IO m)Source
A constraint alias (-XConstraintKinds) to make functions dealing with
GhcModT somewhat cleaner.
Basicially an IOish m => m is a Monad supporting arbitrary IO and
exception handling. Usually this will simply be IO but we parametrise it in
the exported API so users have the option to use a custom inner monad.
Monad utilities
runGhcModT :: IOish m => Options -> GhcModT m a -> m (Either GhcModError a, GhcModLog)Source
Run a GhcModT m computation.
GhcMod utilities
Arguments
| :: IOish m | |
| => ModuleString | A module name. (e.g. "Data.List") |
| -> GhcModT m String |
Checking syntax of a target file using GHC. Warnings and errors are returned.
Checking syntax of a target file using GHC. Warnings and errors are returned.
Expanding Haskell Template.
Arguments
| :: IOish m | |
| => FilePath | A target file. |
| -> Expression | A Haskell expression. |
| -> GhcModT m String |
Obtaining information of a target expression. (GHCi's info:)
Checking syntax of a target file using hlint. Warnings and errors are returned.
pkgDoc :: IOish m => String -> GhcModT m StringSource
Obtaining the package name and the doc path of a module.
Arguments
| :: IOish m | |
| => FilePath | A target file. |
| -> Int | Line number. |
| -> Int | Column number. |
| -> GhcModT m String |
Obtaining type of a target expression. (GHCi's type:)
Arguments
| :: IOish m | |
| => FilePath | A target file. |
| -> Int | Line number. |
| -> Int | Column number. |
| -> GhcModT m String |
Splitting a variable in a equation.
Arguments
| :: IOish m | |
| => FilePath | A target file. |
| -> Int | Line number. |
| -> Int | Column number. |
| -> GhcModT m String |
Create a initial body from a signature.
findSymbol :: IOish m => Symbol -> GhcModT m StringSource
Looking up SymbolDb with Symbol to [ModuleString]
which will be concatenated. loadSymbolDb is called internally.
lookupSymbol :: IOish m => Symbol -> SymbolDb -> GhcModT m StringSource
Looking up SymbolDb with Symbol to [ModuleString]
which will be concatenated.
dumpSymbol :: IOish m => GhcModT m StringSource
Dumping a set of (Symbol,[ModuleString]) to a file
if the file does not exist or is invalid.
The file name is printed.
SymbolDb
loadSymbolDb :: IO SymbolDbSource
Loading a file and creates SymbolDb.