Safe Haskell | None |
---|---|
Language | Haskell2010 |
Library for spawning and working with Ghci sessions.
- data Ghci
- data GhciError = UnexpectedExit String String
- data Stream
- data Load
- = Loading {
- loadModule :: String
- loadFile :: FilePath
- | Message {
- loadSeverity :: Severity
- loadFile :: FilePath
- loadFilePos :: (Int, Int)
- loadFilePosEnd :: (Int, Int)
- loadMessage :: [String]
- | LoadConfig { }
- = Loading {
- data Severity
- startGhci :: String -> Maybe FilePath -> (Stream -> String -> IO ()) -> IO (Ghci, [Load])
- startGhciProcess :: CreateProcess -> (Stream -> String -> IO ()) -> IO (Ghci, [Load])
- stopGhci :: Ghci -> IO ()
- interrupt :: Ghci -> IO ()
- process :: Ghci -> ProcessHandle
- execStream :: Ghci -> String -> (Stream -> String -> IO ()) -> IO ()
- showModules :: Ghci -> IO [(String, FilePath)]
- showPaths :: Ghci -> IO (FilePath, [FilePath])
- reload :: Ghci -> IO [Load]
- exec :: Ghci -> String -> IO [String]
- quit :: Ghci -> IO ()
Documentation
GHCi shut down
The stream Ghci is talking over.
Load messages
Loading | A module/file was being loaded. |
| |
Message | An error/warning was emitted. |
| |
LoadConfig | A config file was loaded, usually a .ghci file (GHC 8.2 and above only) |
Severity of messages
:: String | Shell command |
-> Maybe FilePath | Working directory |
-> (Stream -> String -> IO ()) | Output callback |
-> IO (Ghci, [Load]) |
Start GHCi by running the given shell command, a helper around startGhciProcess
.
startGhciProcess :: CreateProcess -> (Stream -> String -> IO ()) -> IO (Ghci, [Load]) Source #
Start GHCi by running the described process, returning 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.
To create a CreateProcess
use the functions in System.Process, particularly
shell
and proc
.
Since: 0.6.11
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.
showPaths :: Ghci -> IO (FilePath, [FilePath]) Source #
Return the current working directory, and a list of module import paths