[GHC] #3217: Make GHCi have separate flags for interactive
Haskell expressions
GHC
trac at galois.com
Thu May 28 06:34:20 EDT 2009
#3217: Make GHCi have separate flags for interactive Haskell expressions
---------------------------------+------------------------------------------
Reporter: simonpj | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Compiler | Version: 6.10.2
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Comment (by simonpj):
I've had a chat with Simon. Here is our proposed design.
* Change GHCi so that ''at most one'' module is "fully open", currently
denoted *M in GHCi's prompt. If a module M is "fully open", expressions
typed at the GHCi prompt are interpreted (roughly) as if they were written
in M itself. Specifically:
* All the top-level things in the module are in scope
* The per-module flags in `{-# OPTIONS #-}` and `{-# LANGUAGE #-}`
pragmas
* M's `default` declaration holds
* Note that currently more than one module can be fully open, and their
top level scopes are merged. We propose to make that ''at most one''.
* The `DynFlags` used to compile code will be computed as follows.
* When compiling a module M:
* Start with the baseline `DynFlags`
* Apply flags specified on the original command-line
* Apply flags specified by `:set` in this GHCi session
* Apply flags specified in the module M itself[[BR]][[BR]]
* When compiling an expression typed on the GHCi command line:
* Start with the baseline `DynFlags`
* Apply flags specified on the original command-line
* (Perhaps: apply flags specified by `:set` in this GHCi session. We
aren't sure whether or not to do this.)
* Apply GHCi baseline command-prompt flags (e.g. special defaulting
rules)
* Apply flags specified by `:seti` in this GHCi session
* If there is a fully-open module M, apply flags specified in M
itself. That is, flags in M get the last word.
* Fixing GHCi so that M's `default` declaration holds is a separate job,
but it's really part of the same ball of wax.
Implementing this plan will require some representation changes. In
particular, since we need to apply M's source-code flags in two difference
places, we really need to remember the diffs with M, perhaps as a
`(DynFlags -> DynFlags)` function or something.
This all seems quite feasible, but it's fiddly. Neither plans to implement
it right away, but we'd be happy if someone else did.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3217#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list