|
Scion.Session | Portability | portable | Stability | experimental | Maintainer | nominolo@gmail.com |
|
|
|
|
|
Description |
Utilities to manipulate the session state.
|
|
Synopsis |
|
|
|
|
Exception Types
|
|
data CannotOpenCabalProject | Source |
|
Constructors | | Instances | |
|
|
data NoCurrentCabalProject | Source |
|
Constructors | | Instances | |
|
|
data ComponentDoesNotExist | Source |
|
Constructors | | Instances | |
|
|
Setting Session Parameters
|
|
|
|
|
Reset the state of the session to a defined default state.
Due to some bugs in GHC this isn't completely possible. For example, GHC
retains instance declarations which can lead to problems when you load a
new module which defines a different instance. (You'll get a conflicting
instance error, which can only be resolved by re-starting GHC.)
|
|
|
Sets the current working directory and notifies GHC about the change.
TODO: do we want to adjust certain flags automatically?
|
|
Cabal Projects
|
|
|
:: FilePath | Project root directroy
| -> FilePath | Project dist directory (relative)
| -> ScionM () | | Try to open a Cabal project. The project must already be configured
using the same version of Cabal that Scion was build against.
Use configureCabalProject to automatically configure a project (if it
hasn't been already.)
TODO: Allow other working directories? Would require translating all the
search paths from relative to absolute paths. Furthermore, what should the
output directory be then?
Throws:
- CannotOpenCabalProject if an error occurs (e.g., not configured
project or configured with incompatible cabal version).
|
|
|
|
Return the (configured) package description of the current Cabal project.
Throws:
|
|
|
Return path to the .cabal file of the current Cabal package.
This is useful to identify the project when communicating with Scion from
foreign code, because this does not require serialising the local build
info.
Throws:
|
|
|
|
|
|
|
|
|
Run the steps that Cabal would call before building.
|
|
|
Return the current LocalBuildInfo.
The LocalBuildInfo is the result of configuring a Cabal project,
therefore requires that we have a current Cabal project.
Throws:
|
|
|
Root directory of the current Cabal project.
Throws:
|
|
|
:: Component | | -> ScionM [PackageId] | List of packages that need to be loaded. This corresponds to the
build-depends of the loaded component.
TODO: do something with this depending on Scion mode?
| Set GHC's dynamic flags for the given component of the current Cabal
project (see openCabalProject).
Throws:
|
|
|
|
Set the targets for a GHC.load command from the meta data of the
current Cabal project.
Throws:
|
|
|
|
|
|
|
|
|
|
Make the specified component the active one. Sets the DynFlags to
those specified for the given component. Unloads the possible
Throws:
|
|
|
Return the currently active component.
|
|
Internal Utilities
|
|
|
|
|
|
Compilation
|
|
|
Wrapper for GHC.load.
|
|
|
Unload whatever is currently loaded.
|
|
|
Parses the list of Strings as command line arguments and sets the
DynFlags accordingly.
Does not set the flags if a parse error occurs. XXX: There's currently
no way to find out if there was an error from inside the program.
|
|
|
List all components in the current cabal project.
This can be used to present the user a list of possible items to load.
Throws:
|
|
|
Set the verbosity of the GHC API.
|
|
Background Typechecking
|
|
|
:: FilePath | | -> ScionM (Either String CompilationResult) | First element is False = step 1 above failed.
| Takes an absolute path to a file and attempts to typecheck it.
This performs the following steps:
1. Check whether the file is actually part of the current project. It's
also currently not possible to typecheck a .hs-boot file using this
function. We simply bail out if these conditions are not met.
2. Make sure that all dependencies of the module are up to date.
3. Parse, typecheck, desugar and load the module. The last step is
necessary so that we can we don't have to recompile in the case that
we switch to another module.
4. If the previous step was successful, cache the results in the session
for use by source code inspection utilities. Some of the above steps
are skipped if we know that they are not necessary.
|
|
|
|
Return whether the filepath refers to a file inside the current project
root. Return False if there is no current project.
|
|
|
|
|
|
|
Ensure that all dependencies of the module are already loaded.
Sets focusedModule if it was successful.
|
|
|
Return the ModSummary that refers to the source file.
Assumes that there is exactly one such ModSummary.
|
|
|
|
Produced by Haddock version 2.4.2 |