Re: [Haskell-cafe] How to browse code written by others
On 15.06.2010, at 01:35, Luke Palmer wrote: On Mon, Jun 14, 2010 at 2:02 AM, Jean-Marie Gaillourdet j...@gaillourdet.net wrote: Hello, On 13.06.2010, at 22:32, Martin Drautzburg wrote: I need your advice about how to browse code which was written by someone else (Paul Hudak's Euterpea, to be precise, apx. 1 LOC). I had set some hopes on leksah, and it indeed shows me the interfaces, but I have not yet convinced it to show me more than that. I ran haddock over the sources, and again I could not see more that just signatures. I would be very happy with something like a Smalltalk browser. Something that would let me zoom down to the source code, but with search and hyperlink capabilities (senders and implementers in Smalltalk). Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? I use the following tools: * haddock generated docs with hyperlinked sources * MacVim (or just vim) with Claus Reinke's haskellmode-vim, see: http://projects.haskell.org/haskellmode-vim/index.html Have a look at the screencasts to see documentation lookup, and code navigation: http://projects.haskell.org/haskellmode-vim/screencasts.html Make sure you know how to use tags inside of vim. ghci is able to generate the tagsfiles for you. This allows you to jump to definitions of identifiers. If you go this route, I will shamelessly promote hothasktags instead of ghci. It generates proper tags for qualified imports. That sounds interesting. Thanks for the hint. Regards, Jean-Marie___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
..ghci is able to generate the tagsfiles for you. This allows you to jump to definitions of identifiers. If you go this route, I will shamelessly promote hothasktags instead of ghci. It generates proper tags for qualified imports. What do you mean by proper here? GHCi has the information needed to generate more detailed tags, but the tags file format did not support much more detail last time I checked. Tags for explicitly qualified names could be generated (and probably should be), though that would interact with the default identification of Haskell identifiers in Vim. But if you want to resolve imports properly (or at least a bit better, such as adding import qualified as support, or pointing unqualified uses to the correct import), you need more support from the tags mechanism. There is a tags file format proposal here: http://ctags.sourceforge.net/FORMAT that does (among other scopes) suggest explicitly file-scoped local tags file: Static (local) tag, with a scope of the specified file. When the value is empty, {tagfile} is used. but in Vim 7.2 the help file still says http://vimdoc.sourceforge.net/htmldoc/tagsrch.html#tags-file-format The only other field currently recognized by Vim is file: (with an empty value). It is used for a static tag. If Vim somehow started supporting that extended file:scope format without updating its docs, that would be good to know (what version of Vim? where is this documented?). Your suggested use-case for such a feature is interesting, but we're getting into an area where live calls to a scope resolution tool might make more sense. If one is willing to depend on Vim's Python-binding, one could keep a GHCi session live in the background, track the current file/module, and use the :info -- Defined at output to find the correct definition. Btw, GHCi's :browse! gives information on where available names come from, which can be useful for resolving unqualified names (which map is that?) in unknown code. Claus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
Hello, On 13.06.2010, at 22:32, Martin Drautzburg wrote: I need your advice about how to browse code which was written by someone else (Paul Hudak's Euterpea, to be precise, apx. 1 LOC). I had set some hopes on leksah, and it indeed shows me the interfaces, but I have not yet convinced it to show me more than that. I ran haddock over the sources, and again I could not see more that just signatures. I would be very happy with something like a Smalltalk browser. Something that would let me zoom down to the source code, but with search and hyperlink capabilities (senders and implementers in Smalltalk). Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? I use the following tools: * haddock generated docs with hyperlinked sources * MacVim (or just vim) with Claus Reinke's haskellmode-vim, see: http://projects.haskell.org/haskellmode-vim/index.html Have a look at the screencasts to see documentation lookup, and code navigation: http://projects.haskell.org/haskellmode-vim/screencasts.html Make sure you know how to use tags inside of vim. ghci is able to generate the tagsfiles for you. This allows you to jump to definitions of identifiers. * SourceGraph, it generates an HTML report of a cabal projekt or of any source tree. IMHO, great to get the overall picture. Regards, Jean-Marie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
I've been using the geany http://www.geany.org/ editor recently and I was shocked to find that it has decent source browsing capabilities (that work with haskell even!). You can find where something is defined and find other usages of things. It's a bit crude, but gets the job done well enough. - Job On Sun, Jun 13, 2010 at 4:32 PM, Martin Drautzburg martin.drautzb...@web.de wrote: Hello all, I need your advice about how to browse code which was written by someone else (Paul Hudak's Euterpea, to be precise, apx. 1 LOC). I had set some hopes on leksah, and it indeed shows me the interfaces, but I have not yet convinced it to show me more than that. I ran haddock over the sources, and again I could not see more that just signatures. I would be very happy with something like a Smalltalk browser. Something that would let me zoom down to the source code, but with search and hyperlink capabilities (senders and implementers in Smalltalk). Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
On Mon, Jun 14, 2010 at 2:02 AM, Jean-Marie Gaillourdet j...@gaillourdet.net wrote: Hello, On 13.06.2010, at 22:32, Martin Drautzburg wrote: I need your advice about how to browse code which was written by someone else (Paul Hudak's Euterpea, to be precise, apx. 1 LOC). I had set some hopes on leksah, and it indeed shows me the interfaces, but I have not yet convinced it to show me more than that. I ran haddock over the sources, and again I could not see more that just signatures. I would be very happy with something like a Smalltalk browser. Something that would let me zoom down to the source code, but with search and hyperlink capabilities (senders and implementers in Smalltalk). Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? I use the following tools: * haddock generated docs with hyperlinked sources * MacVim (or just vim) with Claus Reinke's haskellmode-vim, see: http://projects.haskell.org/haskellmode-vim/index.html Have a look at the screencasts to see documentation lookup, and code navigation: http://projects.haskell.org/haskellmode-vim/screencasts.html Make sure you know how to use tags inside of vim. ghci is able to generate the tagsfiles for you. This allows you to jump to definitions of identifiers. If you go this route, I will shamelessly promote hothasktags instead of ghci. It generates proper tags for qualified imports. * SourceGraph, it generates an HTML report of a cabal projekt or of any source tree. IMHO, great to get the overall picture. Regards, Jean-Marie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
Excerpts from Luke Palmer's message of Mon Jun 14 19:35:16 -0400 2010: If you go this route, I will shamelessly promote hothasktags instead of ghci. It generates proper tags for qualified imports. Ooh, that's a good time. (Ditches hasktags for hothasktags). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
Hi Martin With Haddock you can also make the highlighted source as per docs hosted on Hackage. Install hscolour, then when you invoke haddock on the cabal file add the --hyperlink-source flag. No hyperlinks in the source though, just colourization. Thomas Hallgren had another source-to-html tool with hyperlinks in the html source rather than just colourizing, but I'm not sure what happened to it - maybe it is part of Programatica? http://ogi.altocumulus.org/~hallgren/Programatica/ Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to browse code written by others
Excerpts from Martin Drautzburg's message of Sun Jun 13 22:32:18 +0200 2010: Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? I use Vim and tag files generated by Vim. Using gnu idutils or such you can find any occurences of words very fast in large code bases. Of course they are not language aware but they often get the job done. I'd like to share all my scripts. Write me an email if you're interested. Marc Weber ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe