|
Language.Haskell.Interpreter.GHC | Portability | non-portable (GHC API) | Stability | experimental | Maintainer | jcpetruzza@gmail.com |
|
|
|
|
|
Description |
A Haskell interpreter built on top of the GHC API
|
|
Synopsis |
|
|
|
|
Session handling
|
|
data InterpreterSession | Source |
|
|
|
Builds a new session using the (hopefully) correct path to the GHC in use.
(the path is determined at build time of the package)
|
|
|
Builds a new session, given the path to a GHC installation
(e.g. /usr/local/lib/ghc-6.6).
|
|
Error handling
|
|
|
Constructors | | Instances | |
|
|
|
Constructors | | Instances | |
|
|
The interpreter type
|
|
|
Instances | |
|
|
Running the interpreter
|
|
|
Executes the interpreter using a given session. This is a thread-safe
operation, if the InterpreterSession is in-use, the call will block until
the other one finishes.
In case of error, it will throw a dynamic InterpreterError exception.
|
|
Interpreter options
|
|
|
Set to true to allow GHC's extensions to Haskell 98.
|
|
Context handling
|
|
|
Module names are _not_ filepaths.
|
|
|
Tries to load all the requested modules from their source file.
Modules my be indicated by their ModuleName (e.g. "My.Module") or
by the full path to its source file.
The interpreter is reset both before loading the modules and in the event
of an error.
|
|
|
Returns the list of modules loaded with loadModules.
|
|
|
Sets the modules whose context is used during evaluation. All bindings
of these modules are in scope, not only those exported.
Modules must be interpreted to use this function.
|
|
|
Sets the modules whose exports must be in context.
|
|
|
All imported modules are cleared from the context, and
loaded modules are unloaded. It is similar to a :load in
GHCi, but observe that not even the Prelude will be in
context after a reset.
|
|
Module querying
|
|
|
Constructors | | Instances | |
|
|
|
An Id for a class, a type constructor, a data constructor, a binding, etc
|
|
|
|
|
|
|
Gets an abstract representation of all the entities exported by the module.
It is similar to the :browse command in GHCi.
|
|
Type inference
|
|
|
Returns a string representation of the type of the expression.
|
|
|
Tests if the expression type checks.
|
|
|
Returns a string representation of the kind of the type expression.
|
|
Evaluation
|
|
|
Evaluates an expression, given a witness for its monomorphic type.
|
|
|
|
|
Convenience functions to be used with typeCheck to provide witnesses.
Example:
interpret "head [True,False]" (as :: Bool) interpret "head $ map show [True,False]" infer >>= flip interpret (as :: Bool)
|
|
|
eval expr will evaluate show expr.
It will succeed only if expr has type t and there is a Show
instance for t.
|
|
Produced by Haddock version 2.1.0 |