ghc-session-0.1.0.1: Simplified GHC API

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Session.Session

Contents

Synopsis

Session

run :: Session a -> IO a Source

Run session with default config.

initialize :: Session () Source

Initialize session with default config.

runWith :: Config -> Session a -> IO a Source

Run session with custom GHC config.

initializeWith :: Config -> Session () Source

Initialize session with custom GHC config.

Flags

setStrFlags :: [String] -> Session () Source

Set ghc command line arguments.

Imports

setImports :: [Import] -> Session () Source

Set imports and replace existing ones.

withImports :: [Import] -> Session a -> Session a Source

Run a code with temporary imports.

GHC extensions

setFlags :: [ExtensionFlag] -> Session () Source

Set GHC extension flags.

unsetFlags :: [ExtensionFlag] -> Session () Source

Unset GHC extension flags.

withExtensionFlags :: [ExtensionFlag] -> [ExtensionFlag] -> Session a -> Session a Source

Run a code with temporary GHC extension flags.

Expression evaluation

runStmt :: String -> Session () Source

Run statement as in ghci.

runDecls :: String -> Session () Source

Run declaration as in Haskell source file.

runAssignment :: String -> String -> Session () Source

Bind expression do a variable using `let` syntax.

runAssignment' :: String -> String -> Session () Source

Bind expression to a variable using bind syntax. Expression must have type `IO a`.

interpret :: Typeable a => String -> Session a Source

Evaluate expression.

Context and DynFlags protection

sandboxDynFlags :: Session a -> Session a Source

Run a code which can safely modify DynFlags - it will be restored on exit.

sandboxContext :: Session a -> Session a Source

Run a code which can safely modify Context w- it will be restored on exit.

interceptErrors :: Ghc a -> Session a Source

Restore session when exception will be raised.