repl-1.1: IRC friendly REPL library.

Safe HaskellNone

Language.Haskell.Repl

Contents

Synopsis

Documentation

data Repl a Source

Construction

newRepl :: IO (Repl [String])Source

Default GHCi-like Repl

repl'Source

Arguments

:: Chan Input

Input channel

-> Chan (ReplOutput a)

Output channel

-> [String]

Imports, using normal Haskell import syntax

-> [String]

List of compiler flags

-> (String -> String)

Used to build the expression actually sent to GHC

-> (Dynamic -> IO a)

Used to send output to the output Chan.

-> Double

Maximum time to wait for a result, in seconds

-> Int

Maximum line length in Char

-> IO (Repl a) 

Repl smart constructor.

defaultLineLength :: IntSource

defaultLineLength = 512

defaultPatience :: DoubleSource

defaultPatience = 5

Stopping

Interaction

data ReplOutput a Source

Instances

Show a => Show (ReplOutput a) 

prompt :: Repl [String] -> String -> IO [String]Source

Same as prompt_, except it parses the input, and pretty prints the results.

prompt_ :: Repl [String] -> Input -> IO OutputSource

Enter commands and an expression to a Repl, and immediately consume results. However, truncate input to the given length, and stop the computation after the given amount of time in seconds.

send :: Repl a -> Input -> IO ()Source

Send input.

result :: Repl a -> IO (ReplOutput a)Source

Naiively get the next set of results. This does not take into account patiences, patienceForErrors, or lineLength. However, due to laziness, this may not matter.