[Haskell-cafe] Wishful thinking: a text editor that expands
function applications into function definitions
claus.reinke at talk21.com
Fri Apr 3 06:30:42 EDT 2009
One word says more than a thousand pictures: Vim <http://www.vim.org/>.
(well, okay, I'm sure Emacs will do just as well, and some of the more
recent IDEs seem to be catching up;-) plus plugins, of course!-)
- unfolding definitions: if you really want that, it is in the domain of
program transformation systems and refactorers (HaRe, the Haskell
refactorer, has been mentioned - it worked on Haskell'98 sources,
plugging into Vim or Emacs; it would really be great to have funding
for porting that to a modern GHC/Cabal-based environment, but if
you're happy with Haskell'98, and have all the sources, the old HaRe
should still do the job once you get it to build with recent GHCs/libraries)
- looking up definitions: that is supported in various ways in Vim/Emacs
and the like - I'll talk about some Vim examples, as that is what I use.
- tag files (generated by running tools like 'ghc -e :ctags', hasktags,..
over the sources) are a simple database linking identifiers to
definition sites. Based on these, one can jump from identifiers
to definitions (keeping a stack of locations, so one can go back
easily), or open split windows on the definition sites.
See the "Moving through programs" section in Vim's help, also
online at: http://vimdoc.sourceforge.net/htmldoc/usr_29.html .
- the haskellmode plugins for Vim support documentation lookup
(opening the haddocs for the identifier under cursor in a browser),
and the documentation provides source links, if the docs themselves
aren't sufficient. Useful for all those sourceless package installations.
- the haskellmode plugins also support type tooltips (or, if you
don't like tooltips, or are working in a terminal without gui, type
signatures can be displayed in the status line, or added to the
source code). This is currently based on GHCi's :browse!, though,
so you can only get the types of toplevel definitions that way. One
of the insertmode completions also displays types.
- if you explain Haskell's import syntax to Vim, you can also search
in (local) imported files, using Vim's standard keyword search, for
The haskellmode plugins for Vim are currently in the process of moving
to http://projects.haskell.org/haskellmode-vim/ . Which made me notice
that I hadn't updated the publicly available version in quite some time
(announcement to follow when that process has settled down somewhat).
More information about the Haskell-Cafe