[Haskell-cafe] Re: How to browse code written by others

Peter Hercek phercek at gmail.com
Mon Jun 21 11:53:34 EDT 2010

On 06/20/2010 11:05 AM, Claus Reinke wrote:
>> I think Luke means that if you use qualified names then hothasktags 
>> can give you better location information than current ghci ctags.
> GHCi :ctags doesn't output tags for qualified names (though it
> probably should), but that isn't enough for proper handling of
> qualified imports. I believe hothasktags is meant to output
> multiple tags per target, one for each module referencing the
> target.

I understand it that way too.

> But that would rely on scoped tags.

By scoped tags, I understand tags valid only in the given scope (which 
is a file for the sake of qualified imports) which is the same as static 
tags which are supposed to be valid inside a file too ... but they are 
not as I found out from your example later :-(

>> I discussed this with Luke before and I sumarrized what would need to 
>> be done to imporove ghci ctags to support qualified names better. 
>> Here is the post which explains it with an example:
>> http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/73116
> The problem with that example is that all occurrences of B.x point
> to b.hs and C.x always points to c.hs, so it doesn't test the scoping
> aspect of static tags. For instance, if you are in b.hs, and try ':tag 
> C.x',
> you'll still be sent to c.hs, even though that isn't in scope (see also
> ':help tag-priority').

Yes, but this is the way vim works. Vim jumps even when given tag is not 
in scope. C.x is not in scope in b.hs (not as a static nor as a global 
symbol) so vim gives as static tag in a different file which matches 
exactly. Which looks like a reasonable feature for non-hierarchical 
symbols (maybe one is missing an include/import). Well, maybe not so 
much for jumps to tags but definitely usefull in :tselect. If we would 
use hierarchical names for tags then this is not so good and it works 
poorly (if I can say it works at all) for tag completions (^X^]).

> If I add a file d.hs that is the same as a.hs but with the qualifiers
> exchanged:
> module D () where
> import qualified B as C
> import qualified C as B
> localAct = do
>  print B.x
>  print C.x
> and try to add corresponding scoped tags by hand, then I don't
> see the scoping being taken into account (though my Vim is old
> 7.2 from August 2008). Depending on sort order of the tags file,
> either all B.x point to b.hs or all B.x point to c.hs. So, one either
> gets the wrong pointers in a.hs or in d.hs.

You are correct. I thought this works well. Thanks for pointing it out.
It does not work for me in my vim too, version 7.2 too.
This looks to me like a vim bug. Though vim developers may not think so 
since it is not documented anyway.

So it is really questionable how much do the qualified tags make sense 
in vim. I'm much less of a supporter of scoped tags now :-/ Looks like 
it is not worth the effort.


More information about the Haskell-Cafe mailing list