[GHC] #9995: :info enhancements
GHC
ghc-devs at haskell.org
Fri Jan 16 09:07:05 UTC 2015
#9995: :info enhancements
-------------------------------------+-------------------------------------
Reporter: shachaf | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 7.8.4
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Old description:
> `:info` is a very useful ghci command, but there are several improvements
> that could be made:
>
> * It would be useful if `:i` showed not only which module a name is
> defined in, but which module(s) it was imported from in the current
> session.
> * A variant of `:i` that just prints a definition, rather than a
> definition and all instances, would be useful in many cases. E.g. `:i
> Show` prints the definition of `Show`, but then it prints so many
> instances that the definition is scrolled way off the screen.
> * `:i ->` is a parse error; it should behave like `:i (->)`, the way it
> works for other type-level operators.
> * hvr had some more suggestions: "finding out which package a module
> belongs to", "and what module an 'as'-alias is associated with".
> (Currently I think modules are out of `:info`'s scope, but perhaps it
> would be a useful addition.)
New description:
`:info` is a very useful ghci command, but there are several improvements
that could be made:
1. It would be useful if `:i` showed not only which module a name is
defined in, but which module(s) it was imported from in the current
session.
2. A variant of `:i` that just prints a definition, rather than a
definition and all instances, would be useful in many cases. E.g. `:i
Show` prints the definition of `Show`, but then it prints so many
instances that the definition is scrolled way off the screen.
3. `:i ->` is a parse error; it should behave like `:i (->)`, the way it
works for other type-level operators.
4. hvr had some more suggestions: "finding out which package a module
belongs to", "and what module an 'as'-alias is associated with".
(Currently I think modules are out of `:info`'s scope, but perhaps it
would be a useful addition.)
--
Comment (by simonpj):
Sounds good to me.
1. I think this is pretty easy; this info is kept in the `GlobalRdrEnv`.
Someone would have to figure out what to say if something was in scope in
several different ways.
2. Even easier; but now you have to specify what the user should say to
get the two different behaviours. Perhaps `:info` for the terse
behaviour and `:info!` to add the instances? (Though that would be a
change.) Oh, now I look I see that `:info!` is already used for something
to do with instances. So maybe `:info`, `:info!`, and `:info!!`? Or we
could drop instances altogether from `:info`, and instead have a new
command `:instances T`.
3. Sounds plausible. "Just" a parser issue.
4. This is really `:info` for ''modules'', isn't it? So perhaps it's a
variant of `:browse` (which tells you stuff about modules)?
Anyway, if anyone wants to work on the specification, get agreement, and
work on implementation, I can advise. Nothing technically difficult here I
think.
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9995#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list