ghcid-0.6.6: GHCi based bare bones IDE

Safe HaskellNone



Library for spawning and working with Ghci sessions.



data Ghci Source

A GHCi session. Created with startGhci, closed with stopGhci.

The interactions with a Ghci session must all occur single-threaded, or an error will be raised. The only exception is interrupt, which aborts a running computation, or does nothing if no computation is running.


data Stream Source

The stream Ghci is talking over.



data Load Source

Load messages

startGhci :: String -> Maybe FilePath -> (Stream -> String -> IO ()) -> IO (Ghci, [Load]) Source

Start GHCi, returning a function to perform further operation, as well as the result of the initial loading. If you do not call stopGhci then the underlying process may be leaked. The callback will be given the messages produced while loading, useful if invoking something like "cabal repl" which might compile dependent packages before really loading.

stopGhci :: Ghci -> IO () Source

Stop GHCi. Attempts to interrupt and execute :quit:, but if that doesn't complete within 5 seconds it just terminates the process.

interrupt :: Ghci -> IO () Source

Interrupt Ghci, stopping the current computation (if any), but leaving the process open to new input.

process :: Ghci -> ProcessHandle Source

Obtain the progress handle behind a GHCi instance.

execStream :: Ghci -> String -> (Stream -> String -> IO ()) -> IO () Source

Execute a command, calling a callback on each response. The callback will be called single threaded.

showModules :: Ghci -> IO [(String, FilePath)] Source

List the modules currently loaded, with module name and source file.

reload :: Ghci -> IO [Load] Source

Perform a reload, list the messages that reload generated.

exec :: Ghci -> String -> IO [String] Source

Send a command, get lines of result. Must be called single-threaded.

quit :: Ghci -> IO () Source

Send :quit and wait for the process to quit.