ghcitui-0.3.0.0: A Terminal User Interface (TUI) for GHCi
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ghcitui.Ghcid.Daemon

Synopsis

The interpreter state

data InterpState a Source #

Instances

Instances details
Show (InterpState a) Source # 
Instance details

Defined in Ghcitui.Ghcid.Daemon

emptyInterpreterState :: Monoid a => Ghci -> StartupConfig -> InterpState a Source #

Create an empty/starting interpreter state. Usually you don't want to call this directly. Instead use startup.

Startup and shutdown

startup Source #

Arguments

:: String

Command to run (e.g. "ghci" or "cabal repl")

-> FilePath

Working directory to run the start up command in.

-> StartupConfig

Where do we put the logging?

-> DaemonIO (InterpState ())

The newly created interpreter handle.

Start up the GHCi Daemon.

data StartupConfig Source #

Configuration passed during Daemon startup

Constructors

StartupConfig 

Fields

quit :: InterpState a -> IO (InterpState a) Source #

Shut down the GHCi Daemon.

Base operations with the daemon

exec :: Monoid a => Text -> InterpState a -> ExceptT DaemonError IO (InterpState a, [Text]) Source #

Execute an arbitrary command, as if it was directly written in GHCi. It is unlikely you want to call this directly, and instead want to call one of the wrapped functions or execMuted or execCleaned.

execCleaned :: Monoid a => Text -> InterpState a -> ExceptT DaemonError IO (InterpState a, [Text]) Source #

exec, but fully clean the message from prompt.

execMuted :: Monoid a => Text -> InterpState a -> ExceptT DaemonError IO (InterpState a) Source #

exec, but throw out any messages.

Wrapped operations with the daemon

step :: Monoid a => InterpState a -> ExceptT DaemonError IO (InterpState a) Source #

Analogue to :step.

stepInto Source #

Arguments

:: Monoid a 
=> Text 
-> InterpState a

Function name to jump to.

-> ExceptT DaemonError IO (InterpState a)

New interpreter state.

Analogue to :step func.

load :: Monoid a => FilePath -> InterpState a -> DaemonIO (InterpState a) Source #

Analogue to :load filepath. Throws out any messages.

continue :: Monoid a => InterpState a -> DaemonIO (InterpState a) Source #

Analogue to :continue. Throws out any messages.

Breakpoints

getBpInCurModule :: InterpState a -> [Int] Source #

Return a list of breakpoint line numbers in the currently paused file.

getBpInFile :: FilePath -> InterpState a -> [Int] Source #

Return a list of breakpoint line numbers in the given filepath.

toggleBreakpointLine :: Monoid a => BreakpointArg -> InterpState a -> DaemonIO (InterpState a) Source #

Toggle a breakpoint (disable/enable) at a given location.

setBreakpointLine :: Monoid a => BreakpointArg -> InterpState a -> DaemonIO (InterpState a) Source #

Set a breakpoint at a given line.

deleteBreakpointLine :: Monoid a => BreakpointArg -> InterpState a -> DaemonIO (InterpState a) Source #

Delete a breakpoint at a given line.

Tracing

trace :: Monoid a => InterpState a -> DaemonIO (InterpState a) Source #

Analogue to :trace, with no arguments. Throws out any messages.

history :: InterpState a -> DaemonIO (InterpState a, Either Text [Text]) Source #

Analogue to :history. Returns either a Left error message, or a Right list of trace breakpoints.

Tab completion

tabComplete Source #

Arguments

:: Monoid a 
=> Text

Text (prefix) to return autocompletions of. Does not need to be escaped.

-> InterpState a

Interpreter state to use.

-> DaemonIO (InterpState a, (Text, [Text]))

Resulting state, the prefix, and autocompletions.

Return tab completions for a given prefix. Analog to :complete repl "prefix" See https://downloads.haskell.org/ghc/latest/docs/users_guide/ghci.html#ghci-cmd-:complete

Misc

isExecuting :: InterpState a -> Bool Source #

Is the daemon currently in the middle of an expression evaluation?

data BreakpointArg Source #

Location info passed to breakpoint functions.

Constructors

LocalLine !Int

Location in the current file.

ModLoc !ModuleLoc

Location in a module.

run :: DaemonIO r -> IO (Either DaemonError r) Source #

Convert Daemon operation to an IO operation.

type DaemonIO r = ExceptT DaemonError IO r Source #

An IO operation that can fail into a DaemonError. Execute them to IO through run.

data DaemonError Source #

Instances

Instances details
Show DaemonError Source # 
Instance details

Defined in Ghcitui.Ghcid.Daemon

Eq DaemonError Source # 
Instance details

Defined in Ghcitui.Ghcid.Daemon

data LogOutput Source #

Determines where the daemon logs are written.

Instances

Instances details
Show LogOutput Source # 
Instance details

Defined in Ghcitui.Ghcid.LogConfig