GHC Poll: scope in GHCi

Dean Herington
Wed, 09 Jan 2002 10:58:30 -0500

A minor suggestion: Let ":m *M" apply to compiled modules as well as
interpreted.  In other words, ":m +M" requests all top-level entities
(accepting only exported ones for compiled modules) while ":m *M" requests
only exported entities (whether the module is compiled or interpreted).

More generally, though, I dislike allying the "all / exported only" choice
with the "add a module to the scope" command; they should be specified
independently.  In particular, one should be able to make the choice for
each of the modules in the ":m M1..Mn" command.  (Otherwise, how can one
reasonably request a scope consisting of only the exported entities from a
single interpreted module?)

A question: What is the syntax of the "M1..Mn" form?

I like Koen Claessen's suggestion that one be able to request all top-level
names from a compiled module.

Here's a variant of Simon's proposal that addresses the above concerns:

  * Let a <mods> be either the name of a module (implying the set of all
top-level names in that module) or a square-bracketed, space-separated list
of module names (implying the set of names exported from the modules).

  * Let a <modslist> be a list of <mods>s.  Whitespace must separate
adjacent <mods>s when neither is in square brackets.

  * Let the ":module" command take an optional '+' or '-' followed by a
<modslist>.  '+' indicates additions to the scope; '-' indicates
subtractions from the scope; absence of both indicates redefinition of the

Square bracketing is suggested for indicating that only exported names are
desired, to match the prompt syntax.  An alternative for both would be to
prefix each such module name by, say, '*'.  Examples of these two

    Main[IO]> :module + [Char Monad] Foo
    Main Foo[IO Char Monad]>


    Main *IO> :module + *Char *Monad Foo
    Main *IO *Char *Monad Foo>

I think I prefer the latter.