Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 82 lines (59 sloc) 3.428 kB
91e23b7 @nominolo Add HACKING file (incomplete, of course).
nominolo authored
1 This document contains a few notes/ideas/brain dumps for how Scion
2 works or should work.
3
4 # Links
5
6 - [GHC API Haddock documentation][ghc-api]
7 - [Hoogle][] for everything else
8
9 [ghc-api]: http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/index.html
10 [Hoogle]: http://www.haskell.org/hoogle/
11
12 # Session State
13
14 ## GHC Session State
15
16 * **Static Flags**: We cannot change these throughout a session.
17
18 * **Dynamic Flags**: May be set on a per-file basis and a per-project
19 basis. They contain all sorts of stuff including search paths and
20 more. The tricky bit here is resetting the old DynFlags when
21 loading a new component.
22
23 * **Targets and module graph**: The targets are all the files that
24 we are "interested" in. The module graph contains the targets and
25 all the modules it depends on (within the same package). GHC will
26 automatically perform dependency analysis for use (including
27 running the C preprocessor.)
28
29 * **Interactive Context**: The context (set of visible modules and
30 debugger state) of the byte code interpreter.
31
32 ## Scion Session State
33
34 What we really need is some kind of abstraction of the GHC session
35 state. This could be called a "project". Currently we have two ways
36 of setting up the information that makes up the GHC session state.
37
38 * We can load just a single file (like GHCi's `load`).
39
40 Idea: Currently we set the working dir to the directory that the
41 file is in. Since, by default, the search path includes only the
42 current directory, it might be worthwhile to set up a proper
43 search path based on the name of the module. For example, if we
44 load file `/foo/bar/A/B/C.hs` and the module name at the top of
45 the file is `A.B.C` then a reasonable choice of search path would
46 be `foo/bar`. (Unfortunately, getting that module name is not
47 very easy at the moment.)
48
49 * We can load a component of Cabal file. Such a component is either
50 the library or one of the executables specified within the Cabal
51 file. The difficulty here is that in order to get the proper
52 meta-data we have to first configure the project. When selecting
53 such a component the user therefore can do several things:
54
55 1. If the project has not been configured, yet, it has to be
56 **configured**.
57
58 2. If the project has been configured previously (either in the
59 same session or some other time) the user may want to
60 **reconfigure** or **reuse** the existing configuration.
61
62 The first case is obvious. The second case may be triggered both
63 when switching components within the same Cabal project, or when
64 re-opening a project that we have been working on previously.
65
66 ### Configuring a Cabal project
67
68 In addition to the Cabal file to configure, we also need
69
70 * A `dist` directory: The default is `.dist-scion` in the same
71 directory that the Cabal file resides. The main problem with this
72 default is that this directory should be ignored by the version
73 control system, and therefore requires an action on the part of the
74 user. On the other hand, most VCSs support a global settings file,
75 so anyone using Scion only needs to edit the global file once.
76
77 * Command line flags to the `configure` command.
78
79 In the future we could provide a mechanism to put this information in
80 a special file, so the user does not have to provide this information
81 over and over again.
Something went wrong with that request. Please try again.