Simon, thanks for the tips! I have changed the code to use nameModule_maybe and I&#39;ve verified that using that on a function imported through a qualified import works. <div>Claus, Scott, the redirection from one standard package to a GHC package wasn&#39;t my issue. We&#39;re in an IDE that uses GHC, so redirecting to the GHC page instead of the Prelude page is not really an issue, it may just startle some users. GHCi does the same:</div>
<div><div>Prelude&gt; :info map</div><div>map :: (a -&gt; b) -&gt; [a] -&gt; [b]   -- Defined in GHC.Base</div><div>Prelude&gt; :info Prelude.map</div><div>map :: (a -&gt; b) -&gt; [a] -&gt; [b]   -- Defined in GHC.Base</div>
<div><br></div><div>But I still would like to find a workaround to be able to jump to the definition even after the type checking rewrite Simon explains, in GHC 6.10/12. I&#39;ll keep poking on how to get from that lambda function to the real function it calls.</div>
<div><br></div><div>Thanks to all,</div><div><br></div><div>JP</div><br><div class="gmail_quote">On Thu, Nov 18, 2010 at 2:36 PM,  <span dir="ltr">&lt;<a href="mailto:scooter.phd@gmail.com">scooter.phd@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Claus:<br>
<br>
Respectfully, &quot;No duh!&quot; as schoolkids here in the US like to say when someone points out the obvious to them.<br>
<br>
And &quot;impossible&quot; is the right word since the predicate evaluates to a boolean. Since false is the outcome, &quot;impossible&quot; refers correctly to the status of fetching the documentation.<br>
<br>
Yes, we&#39;ve been looking at the GHC sources. Why else would the question be posed with regard to &quot;is there a better way of doing this?&quot; Personally, I&#39;ve had my fun re-implementing cabal package reading, and recreating someone else&#39;s work is counterproductive.<br>

<div class="im"><br>
<br>
-scooter<br>
Sent from my Verizon Wireless BlackBerry<br>
<br>
-----Original Message-----<br>
From: &quot;Claus Reinke&quot; &lt;<a href="mailto:claus.reinke@talk21.com">claus.reinke@talk21.com</a>&gt;<br>
</div><div class="im">Date: Thu, 18 Nov 2010 10:53:05<br>
To: &lt;<a href="mailto:scooter.phd@gmail.com">scooter.phd@gmail.com</a>&gt;; &lt;<a href="mailto:glasgow-haskell-users@haskell.org">glasgow-haskell-users@haskell.org</a>&gt;<br>
Subject: Re: Using the GHC API: pretty printing with qualified names<br>
<br>
</div><div><div></div><div class="h5">&gt; scion-server mimics a GHCi command line, of sorts. scion-server<br>
&gt; is used very successfully to syntax-highlight the Eclipse editor,<br>
&gt; show a source&#39;s outline, provide type information when hovering<br>
&gt; over a name, and provide completions.<br>
<br>
&gt; That&#39;s not the problem, per se. Let&#39;s say I&#39;m hovering over a<br>
&gt; function that&#39;s imported by Data.Map. When resolved, the<br>
&gt; symbols appear to come from Ghc.Map (if memory serves<br>
&gt; correctly), which makes finding the correct &quot;haddock&quot; impossible.<br>
<br>
&quot;Impossible&quot; is such an ugly word;-)<br>
<br>
The problem you encounter is that the GHC API is still, to a<br>
large part, just an open window into what happens to be<br>
in GHC. Since GHC&#39;s aims as a compiler differ from those<br>
of IDEs, its exposed functionality will sometimes be too<br>
limited to serve your purposes (eg, if GHC knows where<br>
a function is defined, it doesn&#39;t need to know how it was<br>
imported, once it gets past error reporting).<br>
<br>
If you tie yourself too closely to GHC&#39;s view, some things<br>
you&#39;d like to do in an IDE will _appear_ to be impossible.<br>
That is why I recommend looking into the GHCi sources,<br>
because GHCi&#39;s needs are closer to those of an IDE.<br>
<br>
I assume you mean things like Data.List.map being a<br>
re-exported GHC.List.map being a re-exported GHC.Base.map,<br>
and :info not knowing about  the intended abstractions:<br>
<br>
    Prelude&gt; :i map<br>
    map :: (a -&gt; b) -&gt; [a] -&gt; [b]   -- Defined in GHC.Base<br>
<br>
You can actually get information about possible import<br>
paths via :browse!<br>
<br>
    Prelude&gt; :m +Data.List<br>
    Prelude Data.List&gt; :grep map|imported :browse!<br>
<br>
    -- imported via Data.List<br>
    mapAccumL :: (acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; [x] -&gt; (acc, [y])<br>
    mapAccumR :: (acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; [x] -&gt; (acc, [y])<br>
    -- imported via Data.List, Prelude<br>
    map :: (a -&gt; b) -&gt; [a] -&gt; [b]<br>
<br>
(:browse! is standard GHCi, :grep is non-standard, just to filter<br>
:browse! output). So the :browse! command seems to be able<br>
to find more of the information you want.<br>
<br>
haskellmode for Vim, on the other hand, has long provided<br>
haddock lookup, and will offer you a menu of possible<br>
destinations when your cursor is over &#39;map&#39;. This menu is<br>
built from an index of Haddock entries, which is extracted<br>
from installed Haddock documentation.<br>
<br>
Nothing impossible about that, just ugly: so far, the index<br>
is scraped from Haddock&#39;s HTML index files. That route<br>
breaks occasionally (recent Haddock HTML changes,<br>
ghc-pkg listing wrong Haddock paths, ..; I&#39;m about to<br>
publish updated scraping code for GHC-7.0.1&#39;s Haddock..).<br>
<br>
To get something less ugly, I&#39;m currently recoding the<br>
extraction by using Haddock&#39;s API and .haddock files<br>
(that&#39;ll still break when the API changes, also there is<br>
a pending bug about ghc-pkg, cabal, and haddock<br>
disagreeing about filepath formats, meaning that<br>
.haddock files aren&#39;t found on Windows).<br>
<br>
I assume that code will be useful to other Haskell IDEs,<br>
though it is mostly exposing Haddock&#39;s internal ability to<br>
build an index from .haddock files, which I&#39;d like to see<br>
exposed in Haddock&#39;s less-than-well-known API:<br>
<br>
    <a href="http://trac.haskell.org/haddock/ticket/157" target="_blank">http://trac.haskell.org/haddock/ticket/157</a><br>
<br>
Claus<br>
<br>
<br>
</div></div><br>_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>JP Moresmau<br><a href="http://jpmoresmau.blogspot.com/">http://jpmoresmau.blogspot.com/</a><br>
</div>