ide-backend-0.10.0: An IDE backend library

Safe HaskellNone
LanguageHaskell2010

IdeSession.GHC.Client

Contents

Description

Client interface to the `ide-backend-server` process

It is important that none of the types here rely on the GHC library.

Synopsis

Starting and stopping the server

forkGhcServer Source

Arguments

:: [String]

Initial ghc options

-> [FilePath]

Relative includes

-> [String]

RTS options

-> IdeStaticInfo

Session setup info

-> IdeCallbacks

Session callbacks

-> IO (Either ExternalException (GhcServer, GhcVersion)) 

Start the ghc server

Interacting with the server

data RunActions a Source

Handles to the running code snippet, through which one can interact with the snippet.

Requirement: concurrent uses of supplyStdin should be possible, e.g., two threads that share a RunActions should be able to provide input concurrently without problems. (Currently this is ensured by supplyStdin writing to a channel.)

Constructors

RunActions 

Fields

runWait :: IO (Either ByteString a)

Wait for the code to output something or terminate

interrupt :: IO ()

Send a UserInterrupt exception to the code

A call to interrupt after the snippet has terminated has no effect.

supplyStdin :: ByteString -> IO ()

Make data available on the code's stdin

A call to supplyStdin after the snippet has terminated has no effect.

forceCancel :: IO ()

Force terminate the runaction (The server will be useless after this -- for internal use only).

Guranteed not to block.

runWaitAll :: forall a. RunActions a -> IO (ByteString, a) Source

Repeatedly call runWait until we receive a Right result, while collecting all Left results

rpcCompile Source

Arguments

:: GhcServer

GHC server

-> Bool

Should we generate code?

-> Targets

Targets

-> (UpdateStatus -> IO ())

Progress callback

-> IO GhcCompileResult 

Compile or typecheck

rpcRun Source

Arguments

:: GhcServer

GHC server

-> RunCmd

Run command

-> (Maybe RunResult -> IO a)

Translate run results Nothing indicates force cancellation

-> IO (RunActions a) 

Run code

NOTE: This is an interruptible operation

rpcCrash :: GhcServer -> Maybe Int -> IO () Source

Crash the GHC server (for debugging purposes)

rpcSetEnv :: GhcServer -> [(String, Maybe String)] -> IO () Source

Set the environment

rpcSetArgs :: GhcServer -> [String] -> IO () Source

Set command line arguments

rpcBreakpoint :: GhcServer -> ModuleName -> SourceSpan -> Bool -> IO (Maybe Bool) Source

Set breakpoint

Returns Just the old value of the break if successful, or Nothing if the breakpoint could not be found.

rpcPrint :: GhcServer -> Name -> Bool -> Bool -> IO VariableEnv Source

Print a variable

rpcLoad :: GhcServer -> [FilePath] -> IO (Maybe String) Source

Load an object file

rpcUnload :: GhcServer -> [FilePath] -> IO () Source

Unload an object file

rpcSetGhcOpts :: GhcServer -> [String] -> IO ([String], [String]) Source

Set ghc options