summaryrefslogtreecommitdiff
path: root/rts/ThreadLabels.h
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2015-09-13 13:19:13 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2015-09-13 17:09:13 +0200
commita4738680ab35fb5d844609fc8755c46268ad6800 (patch)
tree9f317b47982cf1c1d7c364345f5a7f26acebb729 /rts/ThreadLabels.h
parentc8d438fb027cbefa31941d8397539c481a03a74f (diff)
downloadhaskell-wip/T10874.tar.gz
Merge new commands from ghci-ng (re #10874)wip/T10874
This was for the major part implemented by Chris Done on https://github.com/chrisdone/ghci-ng and has been in use by Emacs's `haskell-mode` for about a year already. I've squashed the commits, rebased to GHC HEAD, and cleaned up the patch. ----- The new commands this commit adds are (description copied from [1]): * The `:set +c` command: collect information about modules after they've been loaded, and remember it between loads (including failed ones). I recommend adding this line to your `~/.ghci` file. * The `:type-at` command (requires `+c`): show the type at the given position in the module. Example: ``` haskell *X> :type-at X.hs 6 6 6 7 f Int -> Int ``` This can be useful to get the type of a pattern variable or an arbitrary selected expression. The parameters are: <filename> <line> <col> <end-line> <end-col> <text> `text` is used for when the span is out of date, i.e. the file changed and the code has moved, text can be used to confirm the contents of the span matches, and to fallback to a general :t-like lookup. * The `:loc-at` command (requires `+c`): get the location of the thing at the given position in the module. Example: ``` haskell *X> :loc-at X.hs 6 14 6 16 mu X.hs:(8,7)-(8,9) ``` This is useful for goto-definition features of editors and IDEs. Parameters are the same as for `:type-at`. * The `:uses` command (requires `+c`): gets all module-local uses of the thing at the given position in the module. Example: ``` haskell > :uses /home/chris/Projects/ghci-ng/ghc/GhciFind.hs 53 66 53 70 name /home/chris/Projects/ghci-ng/ghc/GhciFind.hs:(46,25)-(46,29) /home/chris/Projects/ghci-ng/ghc/GhciFind.hs:(47,37)-(47,41) /home/chris/Projects/ghci-ng/ghc/GhciFind.hs:(53,66)-(53,70) /home/chris/Projects/ghci-ng/ghc/GhciFind.hs:(57,62)-(57,66) ``` This is useful for highlighting and navigating all uses of an identifier in editors and IDEs. Parameters are the same as for `:type-at`. * The `:all-types` command (requires `+c`): list *all* types in the project: expressions, bindings top-level and local. Sort of like `:browse` on steroids. ``` haskell > :all-types ghc/GhciTypes.hs:(38,13)-(38,24): Maybe Id ghc/GhciTypes.hs:(45,10)-(45,29): Outputable SpanInfo ghc/GhciTypes.hs:(45,10)-(45,29): (Rational -> SpanInfo -> SDoc) -> Outputable SpanInfo ``` [1]: https://github.com/chrisdone/ghci-ng/blob/master/README.md
Diffstat (limited to 'rts/ThreadLabels.h')
0 files changed, 0 insertions, 0 deletions