Library for spawning and working with Ghci sessions.
- data Ghci
- data GhciError = UnexpectedExit String String
- data Stream
- data Load
- data Severity
- startGhci :: String -> Maybe FilePath -> (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)]
- reload :: Ghci -> IO [Load]
- exec :: Ghci -> String -> IO [String]
- quit :: Ghci -> IO ()
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.
GHCi shut down
The stream Ghci is talking over.
Severity of messages
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.
Stop GHCi. Attempts to interrupt and execute
:quit:, but if that doesn't complete
within 5 seconds it just terminates the process.
Interrupt Ghci, stopping the current computation (if any), but leaving the process open to new input.
Execute a command, calling a callback on each response. The callback will be called single threaded.
List the modules currently loaded, with module name and source file.
Send a command, get lines of result. Must be called single-threaded.