| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Language.Haskell.Ghcid
Description
Library for spawning and working with Ghci sessions.
Synopsis
- data Ghci
- data GhciError = UnexpectedExit {}
- data Stream
- data Load
- = Loading {
- loadModule :: String
- loadFile :: FilePath
- | Message {
- loadSeverity :: Severity
- loadFile :: FilePath
- loadFilePos :: (Int, Int)
- loadFilePosEnd :: (Int, Int)
- loadMessage :: [String]
- | LoadConfig { }
- | Eval EvalResult
- = 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
Constructors
| UnexpectedExit | |
Fields | |
Instances
| Data GhciError Source # | |
Defined in Language.Haskell.Ghcid.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GhciError -> c GhciError Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c GhciError Source # toConstr :: GhciError -> Constr Source # dataTypeOf :: GhciError -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c GhciError) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GhciError) Source # gmapT :: (forall b. Data b => b -> b) -> GhciError -> GhciError Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GhciError -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GhciError -> r Source # gmapQ :: (forall d. Data d => d -> u) -> GhciError -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> GhciError -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> GhciError -> m GhciError Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GhciError -> m GhciError Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GhciError -> m GhciError Source # | |
| Exception GhciError Source # | Make GhciError an exception |
Defined in Language.Haskell.Ghcid.Types Methods toException :: GhciError -> SomeException Source # fromException :: SomeException -> Maybe GhciError Source # displayException :: GhciError -> String Source # | |
| Show GhciError Source # | |
| Eq GhciError Source # | |
| Ord GhciError Source # | |
Defined in Language.Haskell.Ghcid.Types | |
The stream Ghci is talking over.
Instances
| Data Stream Source # | |
Defined in Language.Haskell.Ghcid.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Stream -> c Stream Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Stream Source # toConstr :: Stream -> Constr Source # dataTypeOf :: Stream -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Stream) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Stream) Source # gmapT :: (forall b. Data b => b -> b) -> Stream -> Stream Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Stream -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Stream -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Stream -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Stream -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Stream -> m Stream Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Stream -> m Stream Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Stream -> m Stream Source # | |
| Bounded Stream Source # | |
| Enum Stream Source # | |
Defined in Language.Haskell.Ghcid.Types Methods succ :: Stream -> Stream Source # pred :: Stream -> Stream Source # toEnum :: Int -> Stream Source # fromEnum :: Stream -> Int Source # enumFrom :: Stream -> [Stream] Source # enumFromThen :: Stream -> Stream -> [Stream] Source # enumFromTo :: Stream -> Stream -> [Stream] Source # enumFromThenTo :: Stream -> Stream -> Stream -> [Stream] Source # | |
| Read Stream Source # | |
| Show Stream Source # | |
| Eq Stream Source # | |
| Ord Stream Source # | |
Load messages
Constructors
| Loading | A module/file was being loaded. |
Fields
| |
| Message | An error/warning was emitted. |
Fields
| |
| LoadConfig | A config file was loaded, usually a .ghci file (GHC 8.2 and above only) |
| Eval EvalResult | A response to an eval comment |
Severity of messages
Instances
Arguments
| :: 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