doctest-parallel-0.4: Test interactive Haskell examples

Safe Haskell | None
Language | Haskell2010

Test.DocTest.Internal.Interpreter

Contents

- exported for testing

Synopsis

- data Interpreter
- safeEval :: Interpreter -> String -> IO (Either String String)
- safeEvalIt :: Interpreter -> String -> IO (Either String String)
- withInterpreter :: DebugLogger -> [String] -> (Interpreter -> IO a) -> IO a
- ghc :: FilePath
- interpreterSupported :: IO Bool
- ghcInfo :: IO [(String, String)]
- haveInterpreterKey :: String

# Documentation

data Interpreter Source #

safeEval :: Interpreter -> String -> IO (Either String String) Source #

Evaluate an expression; return a Left value on exceptions.

An exception may e.g. be caused on unterminated multiline expressions.

safeEvalIt :: Interpreter -> String -> IO (Either String String) Source #

withInterpreter Source #

Arguments

:: DebugLogger | Debug logger
-> [String] | List of flags, passed to GHC
-> (Interpreter -> IO a) | Action to run
-> IO a | Result of action

Run an interpreter session.

Example:

    >>> withInterpreter noLogger [] $ \i -> eval i "23 + 42"
    "65\n"

ghc :: FilePath Source #

interpreterSupported :: IO Bool Source #

# exported for testing

ghcInfo :: IO [(String, String)] Source #

haveInterpreterKey :: String Source #