haskell / haskell/haskell-mode

Package library support for haskell-mode-goto-loc

Open
#723 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
1.4k
Forks
354
Avg merge
5d 10h
Merged PRs (30d)
2

Description

I feel like this is the only feature in Haskell mode I'm missing. Right now I have to Hoogle, Hayoo, or Google the function name, pick the right package version, click source, hope it navigates to the right place, and read the unformatted source in my web browser.

It would much nicer to just be able to naviage to _any_ functions source seamlessly.

I had some luck using ghci-ng like this:

``` shell
λ> :loc-at /home/cody/programming/haskell/haskell-hello/Main.hs 6 6 6 10 drop
base:GHC.List
λ> :load /home/cody/source/unsorted/ghc-7.8.3/libraries/base/GHC/List.lhs
[1 of 1] Compiling GHC.List ( /home/cody/source/unsorted/ghc-7.8.3/libraries/base/GHC/List.lhs, dist/build/haskell-hello/haskell-hello-tmp/GHC/List.o )
Ok, modules loaded: GHC.List.
Collecting type info for 1 module(s) ...
λ> :loc-at /home/cody/programming/haskell/haskell-hello/Main.hs 6 6 6 10 drop
/home/cody/source/unsorted/ghc-7.8.3/libraries/base/GHC/List.lhs:(426,1)-(426,5)
```

My idea was to add something like customizable variable such as "ghc-source-directory" to Haskell-mode, then when haskell-interactive-mode starts, load all of the libraries. For instance:

```
:load /home/cody/source/unsorted/ghc-7.8.3/libraries/base/GHC/List.lhs
:load ... other base packages
```

Does this approach seem like it will work? See the following dialogue with @thoughtpolice:

```
2015-06-14 16:45 I'm trying to load ghc's base libraries
into ghci from source and having
problems: http://lpaste.net/134509
2015-06-14 16:56 codygman: You need to use
-i.../libraries/base. libraries/ghci
doesn't exist and libraries/ alone
isn't enough.
2015-06-14 16:56 I assume, anyway. The form ':m
+*Data.List' doesn't work with
'ghci' by default either for
example, because * implies you
have to have the source available.
2015-06-14 16:57 I wouldn't be surprised if it
still didn't work or things got
weird, though, loading base into a
GHCi session where it technically
already exists.
2015-06-14 17:02 thoughtpolice: I'm basically trying to
get good goto-definition for the base
libraries. I tried using hasktags but
it goes to ByteString.drop instead of
List.drop for instance.
2015-06-14 17:17 codygman: Hrm, yes, that's a
problem. You definitely don't get
the source to those out of the
box. That's something that could
possibly be fixed in the future.
>
```

Perhaps we could even download the correct version of the GHC source for users (at least those that also use ghci-ng) and set the aforementioned ghc-source-directory variable automatically. I think this would be a good step towards making haskell-mode more interactive.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.