Safe Haskell | None |
---|
Language.Haskell.Repl
Contents
- data Repl a
- newRepl :: IO (Repl [String])
- repl' :: Chan Input -> Chan (ReplOutput a) -> [String] -> [String] -> (String -> String) -> (Dynamic -> IO a) -> Double -> Int -> IO (Repl a)
- defaultFlags :: [String]
- defaultImports :: [String]
- defaultLineLength :: Int
- defaultPatience :: Double
- defaultBuildExpr :: String -> String
- defaultProcessOutput :: Dynamic -> IO [String]
- stopRepl :: Repl a -> IO ()
- data Input
- data ReplOutput a
- data Output
- prompt :: Repl [String] -> String -> IO [String]
- prompt_ :: Repl [String] -> Input -> IO Output
- send :: Repl a -> Input -> IO ()
- result :: Repl a -> IO (ReplOutput a)
- prettyOutput :: Repl a -> Output -> [String]
- parseInput :: Parser Input
Documentation
Construction
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 |
-> Double | Maximum time to wait for a result, in seconds |
-> Int | Maximum line length in |
-> IO (Repl a) |
Repl
smart constructor.
defaultFlags :: [String]Source
defaultLineLength :: IntSource
defaultLineLength = 512
defaultPatience :: DoubleSource
defaultPatience = 5
defaultProcessOutput :: Dynamic -> IO [String]Source
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.
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.
parseInput :: Parser InputSource
Used by prompt